From 1fcdb78fd8705d0e211fbc6b1a7941eca1d0324d Mon Sep 17 00:00:00 2001 From: cat-bro Date: Thu, 20 Apr 2023 22:28:24 +1000 Subject: [PATCH 1/3] first fix test so that it breaks --- tests/test_shell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_shell.py b/tests/test_shell.py index 05ac97b..62724bc 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -287,5 +287,5 @@ def test_dry_run_user_email(self): output = self.call_shell_command( "tpv", "dry-run", "--job-conf", job_config, "--input-size", "6", "--user", "fairycake@vortex.org", tpv_config) - self.assertTrue("name: TEST_JOB_SLOTS" in output, - f"Expected 'name: TEST_JOB_SLOTS' in destination\n{output}") + self.assertTrue("name: TEST_JOB_SLOTS_USER" in output, + f"Expected 'name: TEST_JOB_SLOTS_USER' in destination\n{output}") From b38b05c71d9390e9e5a7f685dea50f4ef66e676b Mon Sep 17 00:00:00 2001 From: cat-bro Date: Thu, 20 Apr 2023 22:30:10 +1000 Subject: [PATCH 2/3] Set the --user argument as user email --- tests/fixtures/mapping-rules.yml | 5 +++++ tests/test_shell.py | 2 +- tpv/commands/dryrunner.py | 7 ++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/fixtures/mapping-rules.yml b/tests/fixtures/mapping-rules.yml index bf83195..afd07e7 100644 --- a/tests/fixtures/mapping-rules.yml +++ b/tests/fixtures/mapping-rules.yml @@ -42,6 +42,11 @@ users: scheduling: require: - pulsar + krikkitrobot@planetkrikkit.org: + env: + TEST_JOB_SLOTS_USER: "{cores}" + params: + native_spec_user: "--mem {mem} --cores {cores}" arthur@vortex.org: scheduling: require: diff --git a/tests/test_shell.py b/tests/test_shell.py index 62724bc..2ecbaed 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -285,7 +285,7 @@ def test_dry_run_user_email(self): job_config = os.path.join(os.path.dirname(__file__), 'fixtures/job_conf_dry_run.yml') tpv_config = os.path.join(os.path.dirname(__file__), 'fixtures/mapping-rules.yml') output = self.call_shell_command( - "tpv", "dry-run", "--job-conf", job_config, "--input-size", "6", "--user", "fairycake@vortex.org", + "tpv", "dry-run", "--job-conf", job_config, "--input-size", "6", "--user", "krikkitrobot@planetkrikkit.org", tpv_config) self.assertTrue("name: TEST_JOB_SLOTS_USER" in output, f"Expected 'name: TEST_JOB_SLOTS_USER' in destination\n{output}") diff --git a/tpv/commands/dryrunner.py b/tpv/commands/dryrunner.py index 214ab95..deee0f3 100644 --- a/tpv/commands/dryrunner.py +++ b/tpv/commands/dryrunner.py @@ -23,11 +23,8 @@ def run(self): @staticmethod def from_params(job_conf, user=None, tool=None, tpv_confs=None, input_size=None): if user is not None: - if '@' in user: - username, email = user.split('@', 1) - else: - username, email = (user, 'example.org') - user = mock_galaxy.User(username, email) + email = user + user = mock_galaxy.User('gargravarr', email) else: user = None From d6aea79acbb2d33517548ff9225f9fb987462a82 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Fri, 21 Apr 2023 18:26:24 +1000 Subject: [PATCH 3/3] remove unused param --- tests/fixtures/mapping-rules.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/fixtures/mapping-rules.yml b/tests/fixtures/mapping-rules.yml index afd07e7..77b31ee 100644 --- a/tests/fixtures/mapping-rules.yml +++ b/tests/fixtures/mapping-rules.yml @@ -45,8 +45,6 @@ users: krikkitrobot@planetkrikkit.org: env: TEST_JOB_SLOTS_USER: "{cores}" - params: - native_spec_user: "--mem {mem} --cores {cores}" arthur@vortex.org: scheduling: require: