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



##########
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 if we use `BeforeMethod` the behaviour is correct, I mean that 
the framework correctly disposes the env and then it set it up correctly for 
the second trial.
   
   Unfortunately many of our tests use BeforeClass/AfterClass, that makes sense 
because we do not want to start a PulsarService for each test.
   
   In my opinion it is better to leave this testRetryCount to 0, and let the 
developer choose locally to set it to an higher value.
   If we want to keep testRetryCount to 1 we should fix all of the tests and 
switch from BeforeClass to BeforeMethod, but this change will have the effect 
of making the suite use more resources and take more time to complete.
   
   If we have flaky tests (that are not so many) we will work to fix them, I 
can help here.
   
   Currently I don't like very much the status of our suite, especially 
**because when a test fails the failure is hidden by an unrelated failure of 
the second trial**
    
   I want to help to make it work better
   
   




----------------------------------------------------------------
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:
[email protected]


Reply via email to