|
17 | 17 | class TestCondorCE(osgunittest.OSGTestCase):
|
18 | 18 |
|
19 | 19 | def setUp(self):
|
20 |
| - # Enforce GSI auth for testing |
21 |
| - os.environ['_condor_SEC_CLIENT_AUTHENTICATION_METHODS'] = 'GSI' |
22 |
| - core.skip_ok_unless_installed('condor', 'htcondor-ce', 'htcondor-ce-client') |
| 20 | + # Enforce SciToken or GSI auth for testing |
| 21 | + os.environ['_condor_SEC_CLIENT_AUTHENTICATION_METHODS'] = 'SCITOKENS, GSI' |
| 22 | + core.skip_ok_unless_installed('condor', 'htcondor-ce') |
23 | 23 | self.skip_bad_unless(service.is_running('condor-ce'), 'ce not running')
|
24 | 24 |
|
| 25 | + self.command = [] |
| 26 | + if core.state['token.condor_write_created']: |
| 27 | + self.command = [f"_condor_SCITOKENS_FILE={core.config['token.condor_write']}"] |
| 28 | + |
25 | 29 | def tearDown(self):
|
26 | 30 | os.environ.pop('_condor_SEC_CLIENT_AUTHENTICATION_METHODS')
|
27 | 31 |
|
| 32 | + def check_write_creds(self): |
| 33 | + """Check for credentials necessary for HTCondor-CE WRITE |
| 34 | + """ |
| 35 | + self.skip_bad_unless(core.state['proxy.valid'] or core.state['token.condor_write_created'], |
| 36 | + 'requires a scitoken or a proxy') |
| 37 | + |
| 38 | + def check_schedd_ready(self): |
| 39 | + """Check if the HTCondor-CE schedd is up as expected |
| 40 | + """ |
| 41 | + self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs') |
| 42 | + |
28 | 43 | def run_blahp_trace(self, lrms):
|
29 | 44 | """Run condor_ce_trace() against a non-HTCondor backend and verify the cache"""
|
30 | 45 | lrms_cache_prefix = {'pbs': 'qstat', 'slurm': 'slurm'}
|
31 | 46 |
|
32 | 47 | cwd = os.getcwd()
|
33 | 48 | os.chdir('/tmp')
|
34 |
| - command = ('condor_ce_trace', '-a osgTestBatchSystem = %s' % lrms.lower(), '--debug', core.get_hostname()) |
35 |
| - trace_out, _, _ = core.check_system(command, 'ce trace against %s' % lrms.lower(), user=True) |
| 49 | + self.command += ['condor_ce_trace', |
| 50 | + '-a osgTestBatchSystem = %s' % lrms.lower(), |
| 51 | + '--debug', |
| 52 | + core.get_hostname()] |
| 53 | + trace_out, _, _ = core.check_system(self.command, 'ce trace against %s' % lrms.lower(), user=True) |
36 | 54 |
|
37 | 55 | try:
|
38 | 56 | backend_jobid = re.search(r'%s_JOBID=(\d+)' % lrms.upper(), trace_out).group(1)
|
@@ -79,38 +97,37 @@ def test_02_queue(self):
|
79 | 97 | core.check_system(command, 'ce queue', user=True)
|
80 | 98 |
|
81 | 99 | def test_03_ping(self):
|
82 |
| - self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') |
83 |
| - |
84 |
| - command = ('condor_ce_ping', 'WRITE', '-verbose') |
85 |
| - stdout, _, _ = core.check_system(command, 'ping using GSI and gridmap', user=True) |
| 100 | + self.check_write_creds() |
| 101 | + self.command += ['condor_ce_ping', 'WRITE', '-verbose'] |
| 102 | + stdout, _, _ = core.check_system(self.command, 'ping using GSI and gridmap', user=True) |
86 | 103 | self.assertTrue(re.search(r'Authorized:\s*TRUE', stdout), 'could not authorize with GSI')
|
87 | 104 |
|
88 | 105 | def test_04_trace(self):
|
89 |
| - self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs') |
90 |
| - self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') |
| 106 | + self.check_schedd_ready() |
| 107 | + self.check_write_creds() |
91 | 108 |
|
92 | 109 | cwd = os.getcwd()
|
93 | 110 | os.chdir('/tmp')
|
94 | 111 |
|
95 |
| - command = ('condor_ce_trace', '--debug', core.get_hostname()) |
96 |
| - core.check_system(command, 'ce trace', user=True) |
| 112 | + self.command += ['condor_ce_trace', '--debug', core.get_hostname()] |
| 113 | + core.check_system(self.command, 'ce trace', user=True) |
97 | 114 |
|
98 | 115 | os.chdir(cwd)
|
99 | 116 |
|
100 | 117 | def test_05_pbs_trace(self):
|
101 |
| - self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs') |
102 | 118 | core.skip_ok_unless_installed('torque-mom', 'torque-server', 'torque-scheduler', 'torque-client', 'munge',
|
103 | 119 | by_dependency=True)
|
104 | 120 | self.skip_ok_unless(service.is_running('pbs_server'), 'pbs service not running')
|
105 |
| - self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') |
| 121 | + self.check_schedd_ready() |
| 122 | + self.check_write_creds() |
106 | 123 | self.run_blahp_trace('pbs')
|
107 | 124 |
|
108 | 125 | def test_06_slurm_trace(self):
|
109 | 126 | core.skip_ok_unless_installed(core.SLURM_PACKAGES)
|
110 |
| - self.skip_bad_unless(service.is_running('munge'), 'slurm requires munge') |
111 | 127 | self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs')
|
112 | 128 | self.skip_ok_unless(service.is_running(core.config['slurm.service-name']), 'slurm service not running')
|
113 |
| - self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') |
| 129 | + self.check_schedd_ready() |
| 130 | + self.check_write_creds() |
114 | 131 | self.run_blahp_trace('slurm')
|
115 | 132 |
|
116 | 133 | def test_07_ceview(self):
|
|
0 commit comments