[ 
https://issues.apache.org/jira/browse/BEAM-5144?focusedWorklogId=147098&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-147098
 ]

ASF GitHub Bot logged work on BEAM-5144:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Sep/18 12:29
            Start Date: 24/Sep/18 12:29
    Worklog Time Spent: 10m 
      Work Description: jbonofre closed pull request #6428: [BEAM-5144] Fix 
unstable test by ensuring acks are processed synchronously
URL: https://github.com/apache/beam/pull/6428
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java 
b/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
index 02b3f77376d..ee5aa541c37 100644
--- a/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
+++ b/sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java
@@ -54,14 +54,12 @@
 import org.apache.beam.sdk.values.PCollection;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
 /** Tests of {@link JmsIO}. */
-@Ignore("TODO(BEAM-5144): Fix this test before reenabling.")
 @RunWith(JUnit4.class)
 public class JmsIOTest {
 
@@ -74,7 +72,7 @@
 
   private BrokerService broker;
   private ConnectionFactory connectionFactory;
-  private ConnectionFactory connectionFactoryWithoutPrefetch;
+  private ConnectionFactory connectionFactoryWithSyncAcksAndWithoutPrefetch;
 
   @Rule public final transient TestPipeline pipeline = TestPipeline.create();
 
@@ -93,6 +91,7 @@ public void startBroker() throws Exception {
     // username and password to use to connect to the broker.
     // This user has users privilege (able to browse, consume, produce, list 
destinations)
     users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
+    users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
     SimpleAuthenticationPlugin plugin = new SimpleAuthenticationPlugin(users);
     BrokerPlugin[] plugins = new BrokerPlugin[] {plugin};
     broker.setPlugins(plugins);
@@ -101,8 +100,9 @@ public void startBroker() throws Exception {
 
     // create JMS connection factory
     connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);
-    connectionFactoryWithoutPrefetch =
-        new ActiveMQConnectionFactory(BROKER_URL + 
"?jms.prefetchPolicy.all=0");
+    connectionFactoryWithSyncAcksAndWithoutPrefetch =
+        new ActiveMQConnectionFactory(
+            BROKER_URL + "?jms.prefetchPolicy.all=0&jms.sendAcksAsync=false");
   }
 
   @After
@@ -275,7 +275,10 @@ public void testCheckpointMark() throws Exception {
     // test, it means that we can have some latency between the 
receiveNoWait() method used by
     // the consumer and the prefetch buffer populated by the broker. Using a 
prefetch to 0 means
     // that the consumer will poll for message, which is exactly what we want 
for the test.
-    Connection connection = 
connectionFactoryWithoutPrefetch.createConnection(USERNAME, PASSWORD);
+    // We are also sending message acknowledgements synchronously to ensure 
that they are
+    // processed before any subsequent assertions.
+    Connection connection =
+        
connectionFactoryWithSyncAcksAndWithoutPrefetch.createConnection(USERNAME, 
PASSWORD);
     connection.start();
     Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
     MessageProducer producer = 
session.createProducer(session.createQueue(QUEUE));
@@ -288,7 +291,7 @@ public void testCheckpointMark() throws Exception {
 
     JmsIO.Read spec =
         JmsIO.read()
-            .withConnectionFactory(connectionFactoryWithoutPrefetch)
+            
.withConnectionFactory(connectionFactoryWithSyncAcksAndWithoutPrefetch)
             .withUsername(USERNAME)
             .withPassword(PASSWORD)
             .withQueue(QUEUE);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 147098)
    Time Spent: 1h 10m  (was: 1h)

> [beam_PostCommit_Java_GradleBuild][org.apache.beam.sdk.io.jms.JmsIOTest.testCheckpointMark][Flake]
>  Expected messages count assert fails
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-5144
>                 URL: https://issues.apache.org/jira/browse/BEAM-5144
>             Project: Beam
>          Issue Type: Bug
>          Components: test-failures
>            Reporter: Mikhail Gryzykhin
>            Assignee: Andrew Fulton
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Failing job url:
> [https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/1196/testReport/]
>  Job history url:
> [https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/1245/testReport/junit/org.apache.beam.sdk.io.jms/JmsIOTest/testCheckpointMark/history/?start=50]
>  Relevant log:
> java.lang.AssertionError: expected:<0> but was:<5> at 
> org.junit.Assert.fail(Assert.java:88) at 
> org.junit.Assert.failNotEquals(Assert.java:834) at 
> org.junit.Assert.assertEquals(Assert.java:645) at 
> org.junit.Assert.assertEquals(Assert.java:631) at 
> org.apache.beam.sdk.io.jms.JmsIOTest.testCheckpointMark(JmsIOTest.java:324) at
>  
> Multiple security exceptions found:
> java.lang.SecurityException: User name [test_user] or password is invalid.
> Aug 07, 2018 6:10:07 PM org.apache.activemq.broker.TransportConnection 
> processAddConnection WARNING: Failed to add Connection 
> ID:apache-beam-jenkins-slave-group-rq04-41395-1533665392741-59:9 due to {} 
> java.lang.SecurityException: User name [null] or password is invalid.
>  
>  
> Additionally, broker service stopped errors:
> org.apache.activemq.broker.BrokerStoppedException: Broker 
> BrokerService[localhost] is being stopped
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to