Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69105

Possibly flakiness in UtilTest#createDirectories()

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • core
    • None
    • 2.360
    • 2.361

    Description

      Using mvn clean verify, the builds exits with the following test failure:

      [ERROR] Tests run: 27, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 0.205 s <<< FAILURE! - in hudson.UtilTest
      [ERROR] hudson.UtilTest.createDirectories  Time elapsed: 0.002 s  <<< FAILURE!
      java.lang.AssertionError: expected:</var/folders/kl/cq42z6q14y10s4494d3039qm0000gn/T/junit5171780981691280544/a/new1> but was:</private/var/folders/kl/cq42z6q14y10s4494d3039qm0000gn/T/junit5171780981691280544/a/new1>
      	at org.junit.Assert.fail(Assert.java:89)
      	at org.junit.Assert.failNotEquals(Assert.java:835)
      	at org.junit.Assert.assertEquals(Assert.java:120)
      	at org.junit.Assert.assertEquals(Assert.java:146)
      	at hudson.UtilTest.createDirectories(UtilTest.java:660)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
      	at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
      	at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
      	at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
      	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
      	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
      	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
      	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
      	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
      	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
      	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
      	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
      	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
      	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
      	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
      	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:135)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
      	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
      

      The test case doesn't fail on ci.jenkins.io, but locally for me.
      I'm building with maven 3.8.6 on macOS 12.5 with Java 17.

      Attachments

        Activity

          basil Basil Crow added a comment -

          The actual value is almost the same as the expected value so I suspect that on macOS the temporary directory /var directory is a symlink to /private/var. The test assumes that the temporary directory is not a symlink when computing the expected value and then dereferences the symlink for the actual value to do the comparison, so the solution might be as simple as dereferencing the symlink when computing the expected value, i.e. changing the definition of root to Path root = tmp.getRoot().toPath().toRealPath().

          basil Basil Crow added a comment - The actual value is almost the same as the expected value so I suspect that on macOS the temporary directory /var directory is a symlink to /private/var . The test assumes that the temporary directory is not a symlink when computing the expected value and then dereferences the symlink for the actual value to do the comparison, so the solution might be as simple as dereferencing the symlink when computing the expected value, i.e. changing the definition of root to Path root = tmp.getRoot().toPath().toRealPath() .

          Nice findings, you are right, the directory is indeed symlinked:

          ➜  ~ ls -la /var | grep "\->"
          lrwxr-xr-x@ 1 root  wheel  11 May  9 23:30 /var -> private/var
          

          Right, with #toRealPath() the tests passes for me.

          notmyfault Alexander Brandes added a comment - Nice findings, you are right, the directory is indeed symlinked: ➜ ~ ls -la / var | grep "\->" lrwxr-xr-x@ 1 root wheel 11 May 9 23:30 / var -> private / var Right, with #toRealPath() the tests passes for me.

          People

            notmyfault Alexander Brandes
            notmyfault Alexander Brandes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: