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

Fix flaky GitSCMTest#testSubmoduleFixup #1232

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/test/java/hudson/plugins/git/GitSCMTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.junit.Assume;
MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -1637,9 +1638,7 @@ public void testBlankRepositoryName() throws Exception {
@Test
public void testSubmoduleFixup() throws Exception {
/* Unreliable on Windows and not a platform specific test */
if (isWindows()) {
return;
}
Assume.assumeFalse(isWindows());
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix!

These tests intentionally use the if construct rather than the Assume construct because the Assume construct generates a warning about skipped tests that then is shown as a warning in the warnings ng plugin output. I'd prefer to continue using the early exit without using a JUnit construct so that the warning is not generated.

Alternately, if the waitForCompletion resolves the flakiness in the test, then let's remove the early return and let the test run on Windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've started a test series on my infra to see if the Assume can be removed for Windows. Will report the results here.

MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved
File repo = secondRepo.getRoot();
FilePath moduleWs = new FilePath(repo);
org.jenkinsci.plugins.gitclient.GitClient moduleRepo = Git.with(listener, new EnvVars()).in(repo).getClient();
Expand Down Expand Up @@ -1672,6 +1671,8 @@ public void testSubmoduleFixup() throws Exception {

FreeStyleBuild db = d.getLastBuild();
assertNotNull("downstream build didn't happen",db);

db = rule.waitForCompletion(db);
rule.assertBuildStatusSuccess(db);
}

Expand Down