@@ -929,7 +929,6 @@ public class SCMSourceRetrieverTest {
929929 }
930930
931931 @ Issue ("JENKINS-69731" )
932- //@Ignore("Need help with environment manipulation for the build")
933932 @ Test public void checkDefaultVersion_inline_allowVersionEnvvar () throws Exception {
934933 // Test that @Library('branchylib@${env.TEST_VAR_NAME}')
935934 // is resolved with the TEST_VAR_NAME="feature" in environment.
@@ -996,26 +995,32 @@ public class SCMSourceRetrieverTest {
996995 // to check they override global server settings?
997996 //p1.getEnvironment(r.jenkins.getNode("built-in"), null).put("TEST_VAR_NAME", "feature");
998997
999- /*
1000- // TODO: Make sense of envinject or similar way to set
1001- // envvars into the job or build before it starts.
1002- // Look at how workflow or git plugins do it?..
1003-
1004- // Same job, different value of envvar, nearer in scope:
1005- TreeMap<String, String> testEnv = new TreeMap();
1006- testEnv.put("TEST_VAR_NAME", "feature");
1007- EnvInjectPluginAction ea = new EnvInjectPluginAction(testEnv);
1008- p1.addAction(ea);
1009- p1.save();
1010- p1.scheduleBuild2(0, ea);
1011- r.waitUntilNoActivity();
1012- WorkflowRun b2 = p1.getLastBuild();
1013- r.waitForCompletion(b2);
1014- assertFalse(p1.isBuilding());
1015- r.assertBuildStatusSuccess(b2);
1016- r.assertLogContains("Loading library branchylib@feature", b2);
1017- r.assertLogContains("something very special", b2);
1018- */
998+ // This part of the test is optionally fenced away -
999+ // so developers tinkering on the fix can do so and
1000+ // run it, but for default case it is so far ignored.
1001+ // $ ENABLE_TEST_VAR_NAME_JOBLEVEL=true mvn test -Dtest='SCMSourceRetrieverTest#checkDefaultVersion_inline_allowVersionEnvvar'
1002+ if ("true" .equals (System .getenv ("ENABLE_TEST_VAR_NAME_JOBLEVEL" ))) {
1003+ //@Ignore("Need help with environment manipulation for the build")
1004+
1005+ // TODO: Make sense of envinject or similar way to set
1006+ // envvars into the job or build before it starts.
1007+ // Look at how workflow or git plugins do it?..
1008+
1009+ // Same job, different value of envvar, nearer in scope:
1010+ TreeMap <String , String > testEnv = new TreeMap ();
1011+ testEnv .put ("TEST_VAR_NAME" , "feature" );
1012+ EnvInjectPluginAction ea = new EnvInjectPluginAction (testEnv );
1013+ p1 .addAction (ea );
1014+ p1 .save ();
1015+ p1 .scheduleBuild2 (0 , ea );
1016+ r .waitUntilNoActivity ();
1017+ WorkflowRun b2 = p1 .getLastBuild ();
1018+ r .waitForCompletion (b2 );
1019+ assertFalse (p1 .isBuilding ());
1020+ r .assertBuildStatusSuccess (b2 );
1021+ r .assertLogContains ("Loading library branchylib@feature" , b2 );
1022+ r .assertLogContains ("something very special" , b2 );
1023+ }
10191024 }
10201025
10211026 @ Issue ("JENKINS-43802" )
0 commit comments