Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-6618

Ensure DB is cleaned after Integration Test

    Details

      Description

      AT
      • there exists a servlet which exposes an endpoint to clean the database and get a report about remaining stuff before clean up
      • if the database is clean the endpoint returns 204 but if the database was not clean return an error code and the report of the stuff left in the database

        Issue Links

          Activity

          Hide
          christopher.zell Christopher Zell added a comment -

          Tried so far:

          1. Add servlet in own purge war and call
          Servlet in After and also AfterClass. Problem: war is deployed more than once -> fails
          2. Add servlet in war which is deployed in test case. Problem is to find correct uri, since uri consist of war name.
          3. Purge in after (after is executed in container, AfterClass not) clears successfully all table data. Problem: Test cases with more than one tests in class fails, since most of them depent on the deployment which is also deleted.

          Next possible approaches:

          1. Create new test rule which purge the db after all tests are executed
          2 . Adjust the Ensure plugin to purge the database after test execution
          3. Purge in After class and add servlet into the initWar method. In that case we have to call the servlet and need to find the correct URL.
          4. Rewrite test cases so they independent, use repository service to redeploy the process xml.

          Show
          christopher.zell Christopher Zell added a comment - Tried so far: 1. Add servlet in own purge war and call Servlet in After and also AfterClass. Problem: war is deployed more than once -> fails 2. Add servlet in war which is deployed in test case. Problem is to find correct uri, since uri consist of war name. 3. Purge in after (after is executed in container, AfterClass not) clears successfully all table data. Problem: Test cases with more than one tests in class fails, since most of them depent on the deployment which is also deleted. Next possible approaches: 1. Create new test rule which purge the db after all tests are executed 2 . Adjust the Ensure plugin to purge the database after test execution 3. Purge in After class and add servlet into the initWar method. In that case we have to call the servlet and need to find the correct URL. 4. Rewrite test cases so they independent, use repository service to redeploy the process xml.
          Hide
          christopher.zell Christopher Zell added a comment -

          Short:
          For now the PurgeDatabaseServlet will be requested in the @AfterClass method.

          Detail:

          Arquillian Lifecycle:
          1. Auto deploy
          2. Before class
          ========= CONTAINER =========

          3.1 Before
          3.2 Test
          3.3 After
          3.4 Repeat for each Test 1.1 - 1.3

          =============================
          3. After Class
          4. Auto undeploy

          The report of the database is in this case not necessary, since the database is in this state always unclean!
          But we have a clean state afterwards and the next Test class runs on a clean database.

          Other solution will include to interrupt the arquillian life cycle after the undeployment. This could be done with the arquillian life cycle extension.
          Problem is that the PurgeDatabaseServlet will also be undeployed, so we need to create a new approach. For example listen on a tcp socket or deploy
          in another way. The current approach to clean the database in the @AfterClass fits at this time best (is also less effort).

          We had to remove the TestJarDeployment since this test class fails randomly and we did not find a solution to fix this issue.

          Show
          christopher.zell Christopher Zell added a comment - Short: For now the PurgeDatabaseServlet will be requested in the @AfterClass method. Detail: Arquillian Lifecycle: 1. Auto deploy 2. Before class ========= CONTAINER ========= 3.1 Before 3.2 Test 3.3 After 3.4 Repeat for each Test 1.1 - 1.3 ============================= 3. After Class 4. Auto undeploy The report of the database is in this case not necessary, since the database is in this state always unclean! But we have a clean state afterwards and the next Test class runs on a clean database. Other solution will include to interrupt the arquillian life cycle after the undeployment. This could be done with the arquillian life cycle extension. Problem is that the PurgeDatabaseServlet will also be undeployed, so we need to create a new approach. For example listen on a tcp socket or deploy in another way. The current approach to clean the database in the @AfterClass fits at this time best (is also less effort). We had to remove the TestJarDeployment since this test class fails randomly and we did not find a solution to fix this issue.
          Hide
          christopher.zell Christopher Zell added a comment -

          We moved the Database purging into the EnsureCleanDatabasePlugin since this is easier to maintain. The old changes are reverted.

          Show
          christopher.zell Christopher Zell added a comment - We moved the Database purging into the EnsureCleanDatabasePlugin since this is easier to maintain. The old changes are reverted.

            People

            • Assignee:
              meyer Daniel Meyer
              Reporter:
              sebastian.menski Sebastian Menski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development