Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-1114

Some tests don't use the Services singleton properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: 3.3.2
    • Component/s: None
    • Labels:
      None

      Description

      Some of the test classes keep a reference to the Services singleton as a class variable and then also re-create the Services in some of its test methods. This can cause it to not properly shut down all of the actual services, which can is causing (at least some of) the flakey test failures because some of those still running services interfere with some of the tests.

      The typical pattern where this issue is happening looks like this:

      public class TestWhatever {
           private Services services1;
      
           setup() {
                services1 = new Services();
                services1.init();
           }
      
           testSomething() {
                Services.get().destroy();          // destroys services1's services
                Services services2 = new Services();     // services1 no longer points to the internal singleton
                services2.init();
           }
      
           tearDown() {
                services1.destroy();       // does not destroy the services started by services2, but does set the internal singleton to null so we've now lost the only remaining reference to those services
           }
      

      You can see a concrete example of this by looking at TestStatusTransitService.testCoordStatusTransitServiceSuspendedWithError

      In general, we should make sure to properly destroy the Services at the end of each test

        Attachments

        1. OOZIE-1114.patch
          65 kB
          Robert Kanter

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: