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):
import subprocess
subprocess.run(
[
"./bin/beat",
"--cache",
settings.CACHE_ROOT,
"--prefix",
settings.PREFIX,
"databases",
"index",
"simple_rawdata_access/1",
"--docker",
],
check=True,
)
for version in range(1, 3):
subprocess.run(
[
"./bin/beat",
"--cache",
settings.CACHE_ROOT,
"--prefix",
settings.PREFIX,
"databases",
"index",
f"simple_rawdata_access/{version}",
"--docker",
],
check=True,
)
self.start_scheduling()
self.start_worker("node1", docker=True)
self.check_worker_status("node1", True)
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)
xp.refresh_from_db()
while xp.status != Experiment.DONE:
xp.refresh_from_db()
while xp.status != Experiment.DONE:
xp.refresh_from_db()
echo = xp.blocks.get(name="echo")
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(analysis.status, Block.DONE)
self.assertEqual(echo.status, Block.DONE)
self.assertEqual(analysis.status, Block.DONE)
@skipIf(settings.RUNNING_ON_CI, "Not runnable on the CI")
......@@ -384,27 +386,28 @@ class TestExecution(TestSchedulerBase):
self.check_worker_status("node2", True)
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)
xp.refresh_from_db()
start = time.time()
while xp.status != Experiment.DONE:
self.assertTrue(time.time() - start < self.timeout)
xp.refresh_from_db()
start = time.time()
while xp.status != Experiment.DONE:
self.assertTrue(time.time() - start < self.timeout)
xp.refresh_from_db()
b1 = xp.blocks.get(name="echo1")
b2 = xp.blocks.get(name="echo2")
b3 = xp.blocks.get(name="analysis")
b1 = xp.blocks.get(name="echo1")
b2 = xp.blocks.get(name="echo2")
b3 = xp.blocks.get(name="analysis")
self.assertEqual(b1.status, Block.DONE)
self.assertEqual(b2.status, Block.DONE)
self.assertEqual(b3.status, Block.DONE)
self.assertEqual(b1.status, Block.DONE)
self.assertEqual(b2.status, Block.DONE)
self.assertEqual(b3.status, Block.DONE)
def test_successful_splitted_experiment(self):
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