Uploaded image for project: 'Service Design and Creation'
  1. Service Design and Creation
  2. SDC-1275

Logging core tests fail on Linux without hostname

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Low Low
    • Beijing Release
    • Beijing Release
    • SDC
    • None

      On a Linux machine without a hostname in /etc/hosts, some tests in openecomp-sdc-logging-core fail.

      Workaround – append a hostname to the line in /etc/hosts that contains "12.7.0.0.1 localhost".

      Example: 127.0.0.1      localhost      test-linux-box

       

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      Failed tests:
        HostAddressCacheTest.hostAddressIsAlwaysPopulated:40 expected object to not be null
        GlobalContextProviderTest.providedValuesPopulated:38 expected object to not be null
        LoggingContextTest.contextHasServerAddressWhenPopulated:133 expected object to not be null
        LoggingContextTest.contextHasServerHostWhenPopulated:125 expected object to not be null

       

      Generated exception (expected when Java cannot retrieve local host address):

      java.net.UnknownHostException: test-linux-box: test-linux-box: Name or service not known
      at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
      at org.openecomp.sdc.logging.context.HostAddressCache.read(HostAddressCache.java:72)
      at org.openecomp.sdc.logging.context.HostAddressCache.<init>(HostAddressCache.java:49)
      at org.openecomp.sdc.logging.context.HostAddressCache.<init>(HostAddressCache.java:41)
      at org.openecomp.sdc.logging.slf4j.GlobalContextProvider.<clinit>(GlobalContextProvider.java:33)
      at org.openecomp.sdc.logging.slf4j.SLF4JLoggingServiceProvider.put(SLF4JLoggingServiceProvider.java:48)
      at org.openecomp.sdc.logging.api.LoggingContext.put(LoggingContext.java:47)
      at org.openecomp.sdc.logging.slf4j.LoggingContextTest.contextHasInstanceIdWhenPopulated(LoggingContextTest.java:140)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
      at org.testng.TestRunner.privateRun(TestRunner.java:782)
      at org.testng.TestRunner.run(TestRunner.java:632)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
      at org.testng.SuiteRunner.run(SuiteRunner.java:268)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
      at org.testng.TestNG.run(TestNG.java:1064)
      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132)
      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:193)
      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:94)
      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:202)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:155)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81)
      at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:82)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1010)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:862)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: java.net.UnknownHostException: test-linux-box: Name or service not known
      at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
      at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
      at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
      at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
      ... 65 more

            vempo vempo
            vempo vempo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: