forked from luopingyi/xc_agent_platform_demo
live: EXTERNAL_SERVICE_TOKEN precedence, baked A/B candidates, model|gpu ledger from task/page modelId+gpuType, string total fix, Iluvatar/MTT enums (59 tests)
This commit is contained in:
@@ -14,7 +14,7 @@ class TestLiveCycle(unittest.TestCase):
|
||||
def setUp(self):
|
||||
directory = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(directory.cleanup)
|
||||
self.env = patch.dict(os.environ, {'STRATEGY_ID': 'sid', 'LIVE_STATE_FILE': directory.name + '/state.json', 'CONFIG_PARAMS_SOURCE': 'sample'}, clear=True)
|
||||
self.env = patch.dict(os.environ, {'STRATEGY_ID': 'sid', 'LIVE_STATE_FILE': directory.name + '/state.json', 'CONFIG_PARAMS_SOURCE': 'sample', 'XC_TOKEN': 'synthetic-secret'}, clear=True)
|
||||
self.env.start()
|
||||
self.addCleanup(self.env.stop)
|
||||
_submitted.clear()
|
||||
@@ -64,10 +64,10 @@ class TestLiveCycle(unittest.TestCase):
|
||||
self.cycle([candidate('ok')], ())
|
||||
self.client.submit.assert_called_once()
|
||||
self.assertIn('banned:', self.logs.getvalue())
|
||||
self.assertIn('duplicate', self.logs.getvalue())
|
||||
self.assertIn('all_gpus_done_or_unmapped', self.logs.getvalue())
|
||||
|
||||
def test_remote_duplicate_and_transport_reservation(self):
|
||||
run_cycle([candidate('remote')], self.client, lambda: (1, 'ok', {'org/remote'}))
|
||||
run_cycle([candidate('remote')], self.client, lambda: (1, 'ok', {('org/remote', 'Biren_166m')}))
|
||||
self.client.submit.assert_not_called()
|
||||
self.client.submit.side_effect = OSError('do not log')
|
||||
self.cycle()
|
||||
@@ -76,7 +76,8 @@ class TestLiveCycle(unittest.TestCase):
|
||||
self.assertNotIn('do not log', self.logs.getvalue())
|
||||
|
||||
def test_missing_token_real_reader(self):
|
||||
run_cycle([candidate('a')], self.client)
|
||||
with patch.dict(os.environ, {'XC_TOKEN': ''}):
|
||||
run_cycle([candidate('a')], self.client)
|
||||
self.client.submit.assert_not_called()
|
||||
self.assertIn('missing/invalid_token', self.logs.getvalue())
|
||||
|
||||
@@ -105,5 +106,5 @@ class TestLiveCycle(unittest.TestCase):
|
||||
rows = [dict(model_address='org/unmapped', targetGpu='unknown'), candidate('<MODEL>')]
|
||||
self.cycle(rows, ())
|
||||
self.client.submit.assert_not_called()
|
||||
self.assertIn('gpu_unmapped', self.logs.getvalue())
|
||||
self.assertIn('all_gpus_done_or_unmapped', self.logs.getvalue())
|
||||
self.assertIn('placeholder', self.logs.getvalue())
|
||||
|
||||
Reference in New Issue
Block a user