Commit b2edf95a authored by Samuel GAIST's avatar Samuel GAIST

[utils][tests][scheduling] Add a couple of tests using databases v2

This ensure that the infrastructure still
runs properly with both types of databases.
parent e94ece4d
...@@ -336,40 +336,42 @@ class TestDockerExecution(TestSchedulerBase): ...@@ -336,40 +336,42 @@ class TestDockerExecution(TestSchedulerBase):
import subprocess import subprocess
subprocess.run( for version in range(1, 3):
[ subprocess.run(
"./bin/beat", [
"--cache", "./bin/beat",
settings.CACHE_ROOT, "--cache",
"--prefix", settings.CACHE_ROOT,
settings.PREFIX, "--prefix",
"databases", settings.PREFIX,
"index", "databases",
"simple_rawdata_access/1", "index",
"--docker", f"simple_rawdata_access/{version}",
], "--docker",
check=True, ],
) check=True,
)
self.start_scheduling() self.start_scheduling()
self.start_worker("node1", docker=True) self.start_worker("node1", docker=True)
self.check_worker_status("node1", True) self.check_worker_status("node1", True)
def test_database_rawdata_access_experiment(self): def test_database_rawdata_access_experiment(self):
fullname = "user/user/single/1/single_rawdata_access" for name in ["single_rawdata_access", "single_rawdata_access_db_v2"]:
fullname = "user/user/single/1/single_rawdata_access"
with self.subTest(experiment_name=fullname):
xp = Experiment.objects.get(name=fullname.split("/")[-1])
xp = Experiment.objects.get(name=fullname.split("/")[-1]) schedule_experiment(xp)
xp.refresh_from_db()
schedule_experiment(xp) while xp.status != Experiment.DONE:
xp.refresh_from_db() xp.refresh_from_db()
while xp.status != Experiment.DONE: echo = xp.blocks.get(name="echo")
xp.refresh_from_db() analysis = xp.blocks.get(name="analysis")
echo = xp.blocks.get(name="echo")
analysis = xp.blocks.get(name="analysis")
self.assertEqual(echo.status, Block.DONE) self.assertEqual(echo.status, Block.DONE)
self.assertEqual(analysis.status, Block.DONE) self.assertEqual(analysis.status, Block.DONE)
@skipIf(settings.RUNNING_ON_CI, "Not runnable on the CI") @skipIf(settings.RUNNING_ON_CI, "Not runnable on the CI")
...@@ -384,27 +386,28 @@ class TestExecution(TestSchedulerBase): ...@@ -384,27 +386,28 @@ class TestExecution(TestSchedulerBase):
self.check_worker_status("node2", True) self.check_worker_status("node2", True)
def test_successful_experiment(self): def test_successful_experiment(self):
fullname = "user/user/double/1/double" for name in ["double", "double_db_v2"]:
fullname = f"user/user/double/1/{name}"
with self.subTest(experiment_name=fullname):
xp = Experiment.objects.get(name=fullname.split("/")[-1])
xp = Experiment.objects.get(name=fullname.split("/")[-1]) self.prepare_databases(xp.declaration)
self.prepare_databases(xp.declaration) schedule_experiment(xp)
xp.refresh_from_db()
schedule_experiment(xp) start = time.time()
xp.refresh_from_db() while xp.status != Experiment.DONE:
self.assertTrue(time.time() - start < self.timeout)
start = time.time() xp.refresh_from_db()
while xp.status != Experiment.DONE:
self.assertTrue(time.time() - start < self.timeout)
xp.refresh_from_db()
b1 = xp.blocks.get(name="echo1") b1 = xp.blocks.get(name="echo1")
b2 = xp.blocks.get(name="echo2") b2 = xp.blocks.get(name="echo2")
b3 = xp.blocks.get(name="analysis") b3 = xp.blocks.get(name="analysis")
self.assertEqual(b1.status, Block.DONE) self.assertEqual(b1.status, Block.DONE)
self.assertEqual(b2.status, Block.DONE) self.assertEqual(b2.status, Block.DONE)
self.assertEqual(b3.status, Block.DONE) self.assertEqual(b3.status, Block.DONE)
def test_successful_splitted_experiment(self): def test_successful_splitted_experiment(self):
fullname = "user/user/double/1/double_split_2" fullname = "user/user/double/1/double_split_2"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment