Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-4007

NamespaceAlreadyExists error when multiple unit tests are in a module

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.5.0
    • Component/s: Test
    • Labels:
    • Release Notes:
      Fixed an issue when running multiple unit tests in the same JVM.
    • Rank:
      1|hzy5vb:

      Description

      I have multiple unit test classes in my module and each class extendsTestBase and will call deployApplication. At the end of each of the tests I am calling stopAll() on the applicationManager that deployApplication returns. When the second unit test class runs it gets a NamespaceAlreadyExists exception and cannot run.

      co.cask.cdap.common.NamespaceAlreadyExistsException: 'namespace:default' already exists
      at co.cask.cdap.internal.app.namespace.DefaultNamespaceAdmin.create(DefaultNamespaceAdmin.java:144)
      at co.cask.cdap.test.ConfigurableTestBase.initialize(ConfigurableTestBase.java:288)
      at co.cask.cdap.test.ConfigurableTestBase.initTestBase(ConfigurableTestBase.java:186)
      at co.cask.cdap.test.TestBase.init(TestBase.java:36)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andreas Andreas Neumann
                Reporter:
                jd565c Jeff Dix
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: