diff --git a/config/job_conf.xml.sample_advanced b/config/job_conf.xml.sample_advanced
index 3a659bacbf23..3aecbe246a27 100644
--- a/config/job_conf.xml.sample_advanced
+++ b/config/job_conf.xml.sample_advanced
@@ -283,7 +283,11 @@
true
-
+
+
+
+
+
+ True
+
+
+ False
+
+
+
+
+
+
+
+
+ True
+
+
+ False
+
+
+
diff --git a/test/unit/jobs/test_job_configuration.py b/test/unit/jobs/test_job_configuration.py
index ec19701b1584..f95bc6f8616c 100644
--- a/test/unit/jobs/test_job_configuration.py
+++ b/test/unit/jobs/test_job_configuration.py
@@ -11,6 +11,7 @@
# there are advantages to testing the documentation/examples.
SIMPLE_JOB_CONF = os.path.join( os.path.dirname( __file__ ), "..", "..", "..", "config", "job_conf.xml.sample_basic" )
ADVANCED_JOB_CONF = os.path.join( os.path.dirname( __file__ ), "..", "..", "..", "config", "job_conf.xml.sample_advanced" )
+CONDITIONAL_RUNNER_JOB_CONF = os.path.join( os.path.dirname( __file__ ), "conditional_runners_job_conf.xml" )
class JobConfXmlParserTestCase( unittest.TestCase ):
@@ -27,9 +28,11 @@ def setUp( self ):
self.__write_config_from( SIMPLE_JOB_CONF )
self.app = bunch.Bunch( config=self.config, job_metrics=MockJobMetrics() )
self.__job_configuration = None
+ self.__original_environ = os.environ.copy()
def tearDown( self ):
shutil.rmtree( self.temp_directory )
+ os.environ = self.__original_environ
def test_load_simple_runner( self ):
runner_plugin = self.job_config.runner_plugins[ 0 ]
@@ -137,6 +140,27 @@ def test_macro_expansion( self ):
for name in ["foo_small", "foo_medium", "foo_large", "foo_longrunning"]:
assert self.job_config.destinations[ name ]
+ def test_conditional_runners( self ):
+ self.__write_config_from( CONDITIONAL_RUNNER_JOB_CONF )
+ runner_ids = [ r[ "id" ] for r in self.job_config.runner_plugins ]
+ assert "local2" in runner_ids
+ assert "local3" not in runner_ids
+
+ assert "local2_dest" in self.job_config.destinations
+ assert "local3_dest" not in self.job_config.destinations
+
+ def test_conditional_runners_from_environ( self ):
+ self.__write_config_from( CONDITIONAL_RUNNER_JOB_CONF )
+ os.environ["LOCAL2_ENABLED"] = "False"
+ os.environ["LOCAL3_ENABLED"] = "True"
+
+ runner_ids = [ r[ "id" ] for r in self.job_config.runner_plugins ]
+ assert "local2" not in runner_ids
+ assert "local3" in runner_ids
+
+ assert "local2_dest" not in self.job_config.destinations
+ assert "local3_dest" in self.job_config.destinations
+
# TODO: Add job metrics parsing test.
@property