Commit 7e63c063 authored by Samuel GAIST's avatar Samuel GAIST

[utils][tests][scheduling] Add test for database raw data access

parent da87cebf
......@@ -52,7 +52,7 @@ def start_broker(port, verbosity=0):
call_command("broker", port=port, verbosity=verbosity)
def start_worker(worker_name, broker_address, prefix, cache, verbosity=0):
def start_worker(worker_name, broker_address, prefix, cache, verbosity=0, docker=False):
call_command(
"worker",
name=worker_name,
......@@ -60,6 +60,7 @@ def start_worker(worker_name, broker_address, prefix, cache, verbosity=0):
prefix=prefix,
cache=cache,
verbosity=verbosity,
docker=docker,
)
......@@ -210,7 +211,7 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin):
self.broker.join()
self.broker = None
def start_worker(self, name, verbosity=None):
def start_worker(self, name, verbosity=None, docker=False):
if verbosity is None:
verbosity = self.command_verbosity
......@@ -222,6 +223,7 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin):
settings.PREFIX,
settings.CACHE_ROOT,
verbosity,
docker,
),
)
......@@ -327,6 +329,49 @@ class TestConnection(TestSchedulerBase):
# ----------------------------------------------------------
@skipIf(settings.RUNNING_ON_CI, "Not runnable on the CI")
class TestDockerExecution(TestSchedulerBase):
def setUp(self):
super().setUp()
import subprocess
subprocess.run(
[
"./bin/beat",
"--cache",
settings.CACHE_ROOT,
"--prefix",
settings.PREFIX,
"databases",
"index",
"simple_rawdata_access/1",
"--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"
xp = Experiment.objects.get(name=fullname.split("/")[-1])
schedule_experiment(xp)
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")
self.assertEqual(echo.status, Block.DONE)
self.assertEqual(analysis.status, Block.DONE)
@skipIf(settings.RUNNING_ON_CI, "Not runnable on the CI")
class TestExecution(TestSchedulerBase):
def setUp(self):
......
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