Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2632

Make UnavailableServletTestCase.testTempUnavailableServlet idempotent

XMLWordPrintable

      the test io.undertow.servlet.test.spec.UnavailableServletTestCase.testTempUnavailableServlet is not idempotent and fails if run twice in the same JVM, because it pollutes state shared among tests. It may be good to clean this state pollution so that some other tests do not fail in the future due to the shared state polluted by this test.
      Details

      When running UnavailableServletTestCase.testTempUnavailableServlet twice, the second run would fail with the following assertion:

      HttpResponse result = client.execute(get);
      Assert.assertEquals(StatusCodes.SERVICE_UNAVAILABLE, result.getStatusLine().getStatusCode());
      

      The reason for this is that the staticUnavailableServlet.first is set to false during the first test run. As a result, during the second run, the HTTP response would return a StatusCodes.OK instead of StatusCodes.SERVICE_UNAVAILABLE. The fix is to reset the UnavailableServlet.first to true after each test run of UnavailableServletTestCase.testTempUnavailableServlet.

              flaviarnn Flavia Rainone
              flaviarnn Flavia Rainone
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: