Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1953

Ensure that test methods in different test classes use different cluster addresses

    XMLWordPrintable

Details

    Description

      TestNG will start a method has a @Test(timeout = x) annotation in a separate thread. Because of this, we don't have access to the test name and we have to rely on the method name only to provide a unique identifier for the cluster.

      This approach breaks down when we have a test class extending another, as all the test methods in the parent class are now duplicated. E.g. StateTransferClassLoaderFunctionalTest extends StateTransferFunctionalTest, which leads to failures like this in the test suite:

      Cache at address testSTWithWritingNonTxThread-55146 had 3 members; expecting 2. Members were (testSTWithWritingNonTxThread-55146, testSTWithWritingNonTxThread-61383, testSTWithWritingNonTxThread-7922)
      

      The solution is to force the user to provide the name of the test, e.g. by calling a method backgroundTestStarted(this) at the start of each method with a @Test(timeout = x) annotation. As a bonus, this will make it easier to search for the logs of such test methods.

      Attachments

        Activity

          People

            dberinde@redhat.com Dan Berindei (Inactive)
            dberinde@redhat.com Dan Berindei (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: