Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tests from shallow clone repos #944

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

MarkEWaite
Copy link
Contributor

Allow tests from shallow cloned repositories

Do not attempt to use the local repository as a reference repository when the local repository is a shallow clone. A shallow clone repository has no content to offer as a reference. Fixes 64 test failures when the test repository is a shallow clone.

jenkinsci/bom#1613 describes the experiment to run the plugin compatibility tests with shallow clones.

jenkinsci/git-plugin#1365 implemented a similar change in the git plugin so that shallow cloned repositories will not fail the tests in that plugin.

Will make a few tests in a shallow repository a little slower because they will require a full clone of the git client plugin repository rather than reusing the existing clone in the test workspace. Doubtful that the performance difference will be detectable within the general variability of CI test jobs.

Checklist

  • I have read the CONTRIBUTING doc
  • I have referenced the Jira issue related to my changes in one or more commit messages
  • I have added tests that verify my changes
  • Unit tests pass locally with my changes
  • I have added documentation as necessary
  • No Javadoc warnings were introduced with my changes
  • No spotbugs warnings were introduced with my changes
  • I have interactively tested my changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Do not attempt to use the local repository as a reference repository
when the local repository is a shallow clone.  A shallow clone
repository has no content to offer as a reference.

Fixes 64 test failures when the test repository is a shallow clone.

jenkinsci/bom#1613 describes the experiment to
run the plugin compatibility tests with shallow clones.

jenkinsci/git-plugin#1365 implemented a similar
change in the git plugin so that shallow cloned repositories will not
fail the tests in that plugin.

Will make a few tests in a shallow repository a little slower because
they will require a full clone of the git client plugin repository
rather than reusing the existing clone in the test workspace.  Doubtful
that the performance difference will be detectable within the general
variability of CI test jobs.
@MarkEWaite MarkEWaite added the test Automated test addition or improvement label Dec 5, 2022
@MarkEWaite MarkEWaite closed this Dec 5, 2022
@MarkEWaite MarkEWaite deleted the test-in-shallow-clone branch December 5, 2022 03:56
@MarkEWaite MarkEWaite restored the test-in-shallow-clone branch December 5, 2022 03:57
@MarkEWaite MarkEWaite reopened this Dec 5, 2022
@MarkEWaite MarkEWaite merged commit 5c98434 into jenkinsci:master Dec 5, 2022
@MarkEWaite MarkEWaite deleted the test-in-shallow-clone branch December 5, 2022 04:32
@@ -372,7 +377,13 @@ protected String localMirror() throws IOException, InterruptedException {
* the final destination directory.
*/
Path tempClonePath = Files.createTempDirectory(targetDir.toPath(), "clone-");
w.launchCommand("git", "clone", "--reference", f.getCanonicalPath(), "--mirror", "https://github.com/jenkinsci/git-client-plugin", tempClonePath.toFile().getAbsolutePath());
String repoUrl = "https://github.com/jenkinsci/git-client-plugin.git";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine as a hotfix, but jenkinsci/git-plugin#1365 (review)

MarkEWaite added a commit that referenced this pull request Dec 13, 2022
Do not attempt to use the local repository as a reference repository
when the local repository is a shallow clone.  A shallow clone
repository has no content to offer as a reference.

Fixes 64 test failures when the test repository is a shallow clone.

jenkinsci/bom#1613 describes the experiment to
run the plugin compatibility tests with shallow clones.

jenkinsci/git-plugin#1365 implemented a similar
change in the git plugin so that shallow cloned repositories will not
fail the tests in that plugin.

Will make a few tests in a shallow repository a little slower because
they will require a full clone of the git client plugin repository
rather than reusing the existing clone in the test workspace.  Doubtful
that the performance difference will be detectable within the general
variability of CI test jobs.

(cherry picked from commit 5c98434)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Automated test addition or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants