-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
branch off from git-client-3.11.x (test line in question is from 2018)
git-bash for Windows
Tests on my development branch (though curiously not on master - despite this test not being modified by the PR I am working on) complains for unexpected message from git CLI:
[ERROR] Tests run: 47, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 468.779 s <<< FAILURE! - in org.jenkinsci.plugins.gitclient.CliGitAPIImplTest [ERROR] org.jenkinsci.plugins.gitclient.CliGitAPIImplTest.test_submodule_update_with_error Time elapsed: 17.945 s <<< FAILURE! java.lang.AssertionError:Expected: a string containing "Command \"git submodule update modules/ntp\" returned status code 1" but: was "hudson.plugins.git.GitException: Command "git submodule update modules/ntp" executed in workdir "C:\Users\klimov\Documents\FOSS\jenkins\git-client-plugin\target\tmp\j h735866857001236028" returned status code 1: stdout: stderr: fatal: destination path 'C:/Users/klimov/Documents/FOSS/jenkins/git-client-plugin/target/tmp/j h735866857001236028/modules/ntp' already exists and is not an empty directory. fatal: clone of 'https://github.com/puppetlabs/puppetlabs-ntp.git' into submodule path 'C:/Users/klimov/Documents/FOSS/jenkins/git-client-plugin/target/tmp/j h735866857001236028/modules/ntp' failed Failed to clone 'modules/ntp'. Retry scheduled fatal: destination path 'C:/Users/klimov/Documents/FOSS/jenkins/git-client-plugin/target/tmp/j h735866857001236028/modules/ntp' already exists and is not an empty directory. fatal: clone of 'https://github.com/puppetlabs/puppetlabs-ntp.git' into submodule path 'C:/Users/klimov/Documents/FOSS/jenkins/git-client-plugin/target/tmp/j h735866857001236028/modules/ntp' failed Failed to clone 'modules/ntp' a second time, aborting " at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6) at org.jenkinsci.plugins.gitclient.GitAPITestCase.test_submodule_update_with_error(GitAPITestCase.java:1228) 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.jenkinsci.plugins.gitclient.CliGitAPIImplTest.runTest(CliGitAPIImplTest.java:46) at junit.framework.TestCase.runBare(TestCase.java:142) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:130) at junit.framework.TestSuite.runTest(TestSuite.java:241) at junit.framework.TestSuite.run(TestSuite.java:236) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:377) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:284) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:248) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167) 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)
A quick fix for this particular problem is easy, to expect either of the two wordings, and was PRed as https://github.com/jenkinsci/git-client-plugin/pull/886
Note that the git codebase itself goes to great extents to forbid their own unit-testing code (and tool interactions) from relying on emitted text messages; this stance stalled some of my PRs there since I found no other way, like meaningful exit codes for specific situations, to check whether the state machine is in a certain state