Oozie
  1. Oozie
  2. OOZIE-1597

Cleanup database before every test

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: 4.1.0
    • Component/s: tests
    • Labels:
      None

      Description

      While investigating a flakey test (org.apache.oozie.sla.TestSLAJobEventListener.testOnJobEvent) I realized that some of the flakey SLA tests that I've seen lately are the same issue: The database has some leftover stuff from a previous test that its not expecting.

      Normally this is easy to fix because we can simply call cleanUpDBTables(). However, cleanUpDBTables requires some of the Services to be running, so you have to call it after starting Services; but, some of the failures were occurring during Services initialization (specifically when SLAService initializes the SLACalculatorMemory, which tries to load some data from the database, which may be incomplete (e.g. SLA registration for a job that doesn't exist)). So, in this case, we can't call cleanUpDBTables() before or after starting Services.

      This brings the larger issue that we should be cleaning up the database before every test anyway to make sure that the tests are truly independent and to prevent harmful leaking (just like we did a while back with the Services). I think we should have XTestCase.setup() call cleanUpDBTables() so that every test automatically it (and handle the Services dependency appropriately).

      1. OOZIE-1597.patch
        82 kB
        Robert Kanter

        Activity

        Robert Kanter created issue -
        Robert Kanter made changes -
        Field Original Value New Value
        Attachment OOZIE-1597.patch [ 12610121 ]
        Robert Kanter made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Robert Kanter made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Fix Version/s trunk [ 12323240 ]
        Resolution Fixed [ 1 ]
        Rohini Palaniswamy made changes -
        Fix Version/s 4.1.0 [ 12324960 ]
        Fix Version/s trunk [ 12323240 ]
        Bowen Zhang made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Robert Kanter
            Reporter:
            Robert Kanter
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development