co.cask.cdap.common.NamespaceAlreadyExistsException: 'namespace:default' already exists

Google Groups | Elkhan | 3 months ago
  1. 0

    Running 2 or more test classes extending TestBase in the /src/test/java package fails

    Google Groups | 3 months ago | Elkhan
    co.cask.cdap.common.NamespaceAlreadyExistsException: 'namespace:default' already exists
  2. 0

    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)

    Cask Community Issue Tracker | 1 year ago | Jeff Dix
    co.cask.cdap.common.NamespaceAlreadyExistsException: 'namespace:default' already exists

    Root Cause Analysis

    1. co.cask.cdap.common.NamespaceAlreadyExistsException

      'namespace:default' already exists

      at co.cask.cdap.internal.app.namespace.DefaultNamespaceAdmin.create()
    2. co.cask.cdap
      TestBase.initialize
      1. co.cask.cdap.internal.app.namespace.DefaultNamespaceAdmin.create(DefaultNamespaceAdmin.java:166)
      2. co.cask.cdap.test.TestBase.initialize(TestBase.java:285)
      2 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    4. JUnit
      ParentRunner.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      5. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      6. org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      7. org.junit.rules.RunRules.evaluate(RunRules.java:20)
      8. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      8 frames
    5. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      1 frame
    6. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      5 frames