Skip to content

Commit 6668195

Browse files
committed
SCMSourceRetrieverTest: clarify messages for "SKIP by pre-test assumption" tests
1 parent c2cf4b5 commit 6668195

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/test/java/org/jenkinsci/plugins/workflow/libs/SCMSourceRetrieverTest.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
415415
// by having some checkouts (and so list of SCMs).
416416

417417
// Do not let caller-provided BRANCH_NAME interfere here
418-
assumeFalse("An externally provided BRANCH_NAME envvar interferes with tested logic",
418+
assumeFalse("SKIP by pre-test assumption: " +
419+
"An externally provided BRANCH_NAME envvar interferes with tested logic",
419420
System.getenv("BRANCH_NAME") != null);
420421

421422
sampleRepo1ContentMasterFeature();
@@ -687,7 +688,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
687688
System.out.println("MBP source 0: " + mbp.getSourcesList().get(0).getSource().toString());
688689
System.out.println("MBP source 1: " + mbp.getSourcesList().get(1).getSource().toString());
689690
System.out.println("Jobs generated by MBP: " + mbp.getItems().toString());
690-
assumeFalse("MBP should have generated 'feature' and 'featurette' pipeline job", mbp.getItems().size() != 2);
691+
assumeFalse("SKIP by pre-test assumption: " +
692+
"MBP should have generated 'feature' and 'featurette' pipeline job", mbp.getItems().size() != 2);
691693

692694
// In case of MBP with "Single repository and branch"
693695
// it only defines one job (per single-branch source),
@@ -775,7 +777,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
775777
System.out.println("MBP source 0: " + mbp.getSourcesList().get(0).getSource().toString());
776778
System.out.println("MBP source 1: " + mbp.getSourcesList().get(1).getSource().toString());
777779
System.out.println("Jobs generated by MBP: " + mbp.getItems().toString());
778-
assumeFalse("MBP should have generated 'feature' and 'featurette' pipeline job", mbp.getItems().size() != 2);
780+
assumeFalse("SKIP by pre-test assumption: " +
781+
"MBP should have generated 'feature' and 'featurette' pipeline job", mbp.getItems().size() != 2);
779782

780783
// In case of MBP with "Single repository and branch"
781784
// it only defines one job (per single-branch source),
@@ -867,7 +870,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
867870
// a simple "Pipeline" job with static SCM source,
868871
// and that even lc.setAllowVersionOverride(false)
869872
// does not intervene here.
870-
assumeFalse("An externally provided BRANCH_NAME envvar interferes with tested logic",
873+
assumeFalse("SKIP by pre-test assumption: " +
874+
"An externally provided BRANCH_NAME envvar interferes with tested logic",
871875
System.getenv("BRANCH_NAME") != null);
872876

873877
sampleRepo1ContentMasterFeature();
@@ -917,7 +921,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
917921
// "unexpected" log message (so far expected due
918922
// to the bug being hunted), but counts the faults
919923
// and asserts in the end whether there were none.
920-
assumeFalse("An externally provided BRANCH_NAME envvar interferes with tested logic",
924+
assumeFalse("SKIP by pre-test assumption: " +
925+
"An externally provided BRANCH_NAME envvar interferes with tested logic",
921926
System.getenv("BRANCH_NAME") != null);
922927

923928
sampleRepo1ContentMasterFeatureStable();
@@ -1034,7 +1039,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
10341039
// TODO: If this behavior does change, extend
10351040
// the test to also try ${env.VARNAME} confusion.
10361041

1037-
assumeFalse("An externally provided BRANCH_NAME envvar interferes with tested logic",
1042+
assumeFalse("SKIP by pre-test assumption: " +
1043+
"An externally provided BRANCH_NAME envvar interferes with tested logic",
10381044
System.getenv("BRANCH_NAME") != null);
10391045

10401046
sampleRepo1ContentMasterFeature();
@@ -1079,7 +1085,9 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
10791085
r.assertLogContains("was not a constant; did you mean to use the", b1);
10801086
r.assertLogContains("step instead?", b1);
10811087
// assertions survived, skip the test
1082-
assumeFalse("LibraryDecorator forbids use of double-quotes for @Library annotation", true);
1088+
// not exactly "pre-test" but oh well
1089+
assumeFalse("SKIP by pre-test assumption: " +
1090+
"LibraryDecorator forbids use of double-quotes for @Library annotation", true);
10831091
} catch(AssertionError x) {
10841092
// Chosen library version should not be "whatever"
10851093
// causing fallback to "master", but "feature" per
@@ -1095,7 +1103,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
10951103
// Test that lightweight checkouts from SCM allow
10961104
// @Library('branchylib@${BRANCH_NAME}') to see
10971105
// sufficient SCM context to determine the branch.
1098-
assumeFalse("An externally provided BRANCH_NAME envvar interferes with tested logic",
1106+
assumeFalse("SKIP by pre-test assumption: " +
1107+
"An externally provided BRANCH_NAME envvar interferes with tested logic",
10991108
System.getenv("BRANCH_NAME") != null);
11001109

11011110
sampleRepo1ContentMasterFeature();
@@ -1136,7 +1145,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
11361145
// is resolved with the TEST_VAR_NAME="feature" in environment.
11371146

11381147
// Do not let caller-provided BRANCH_NAME interfere here
1139-
assumeFalse("An externally provided TEST_VAR_NAME envvar interferes with tested logic",
1148+
assumeFalse("SKIP by pre-test assumption: " +
1149+
"An externally provided TEST_VAR_NAME envvar interferes with tested logic",
11401150
System.getenv("TEST_VAR_NAME") != null);
11411151

11421152
sampleRepo1ContentMasterFeatureStable();
@@ -1203,7 +1213,8 @@ private void sampleRepo2ContentUniqueMasterFeatureBogus_staticStrings(String sub
12031213
ecOrig.add(ec);
12041214
}
12051215
ecList.removeAll(ecOrig);
1206-
assumeFalse("EnvironmentContributor.all() should be empty now", !ecList.isEmpty());
1216+
assumeFalse("SKIP by pre-test assumption: " +
1217+
"EnvironmentContributor.all() should be empty now", !ecList.isEmpty());
12071218

12081219
ecList.add(new EnvironmentContributor() {
12091220
@Override public void buildEnvironmentFor(Run run, EnvVars ev, TaskListener tl) throws IOException, InterruptedException {
@@ -1655,7 +1666,8 @@ public static class BasicSCMSource extends SCMSource {
16551666

16561667
@Issue("SECURITY-2463")
16571668
@Test public void checkoutDirectoriesAreNotReusedByDifferentScms() throws Exception {
1658-
assumeFalse("checkoutDirectoriesAreNotReusedByDifferentScms() is " +
1669+
assumeFalse("SKIP by pre-test assumption: " +
1670+
"checkoutDirectoriesAreNotReusedByDifferentScms() is " +
16591671
"skipped on Windows: Checkout hook is not cross-platform",
16601672
Functions.isWindows());
16611673
sampleRepo.init();

0 commit comments

Comments
 (0)