Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12852

Fix unstable test PubNubPresenceTest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.21.3, 2.22.2, 2.23.0
    • tests
    • None
    • Unknown

    Description

      sometimes it is failing with
      https://fusesource-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/camel.redhat.pipeline/job/2.21.x.redhat-7-0-x/18/testReport/junit/org.apache.camel.component.pubnub/PubNubPresenceTest/testPresence/

      Error Message

      mock://result Received message count. Expected: <1> but was: <2>

      Stacktrace

      java.lang.AssertionError: mock://result Received message count. Expected: <1> but was: <2>
      at org.apache.camel.component.pubnub.PubNubPresenceTest.testPresence(PubNubPresenceTest.java:53)

      the problem is that in fact a lot of exchanges are created.
      In org.apache.camel.component.mock.MockEndpoint.doAssertIsSatisfied(long), it is waiting to reach at least the given expected number in the provided timeout.
      As soon as it is reached, it is doing the assertion.
      But between the assertion done in the line just after, a new message may arrive.

      You can notice it by putting a Thread.sleep(1000) for instance before the assertEquals, with PubNubTest it wil lalways fail and there will be a lo tmore messages.

      So 3 possibilities:

      • the test should expect a minimum number of messages
      • the route used in test should be modified to trigger a single message
      • the camel product should not create several messages and in this case it is a product bug

      Attachments

        Activity

          People

            acosentino Andrea Cosentino
            apupier Aurélien Pupier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: