You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/12/24 08:08:42 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #9043: set testRetryCount default to 0

eolivelli commented on a change in pull request #9043:
URL: https://github.com/apache/pulsar/pull/9043#discussion_r548439970



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/DemoPollutedEnvTest.java
##########
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.service;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.Schema;
+import static org.testng.Assert.fail;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * This demo shows that the test is executed twice, but the environment
+ * in the second execution is not a fresh new env,
+ * in fact the consumer is not able to subscribe.
+ * 
+ * org.apache.pulsar.client.api.PulsarClientException$ConsumerBusyException: Exclusive consumer is already connected

Review comment:
       @sijie this test explains my point.
   
   when TestNG sees the first failure it executes again **only the test method**
   during the second execution a subscription with name "mysub" is already registered.
   
   This behaviour makes it useless to rerun a flaky test, because it is possible that the second time the test passes not because the failure was due to some bad design of the test, but because the polluted env enables the test to pass.
   
   In my opinion this is very dangerous and make the suite less reliable overall.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org