From dd2446faf663960d62d9b2aa64d5840c479369dc Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 3 Apr 2019 14:25:48 -0700 Subject: [PATCH] tests: Make sure example-development is present for delete test Use it for the save, delete, push testing for composer-cli tests. Otherwise the test runs fine the first time and fails after that if you don't re-install the test environment. Related: rhbz#1678937 --- tests/composer/test_blueprints.py | 15 ++++++++------- tests/pylorax/repos/single.repo | 2 +- tests/pylorax/test_projects.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/composer/test_blueprints.py b/tests/composer/test_blueprints.py index c073b336..1e4790ea 100644 --- a/tests/composer/test_blueprints.py +++ b/tests/composer/test_blueprints.py @@ -73,22 +73,23 @@ class BlueprintsTest(unittest.TestCase): self.assertTrue("example-http-server" in output) self.assertTrue("Recipe example-http-server, version 0.0.1 saved." in output) + # NOTE: Order of these 3 is important, delete needs to come after save, before push and these 3 @unittest.skipUnless(os.path.exists("/run/weldr/api.socket"), "Test requires a running API server") def test_save_0(self): - """blueprints save""" - blueprints_save("/run/weldr/api.socket", 0, ["example-http-server"], show_json=False) + """blueprints save example-development""" + blueprints_save("/run/weldr/api.socket", 0, ["example-development"], show_json=False) self.assertTrue(os.path.exists("example-http-server.toml")) @unittest.skipUnless(os.path.exists("/run/weldr/api.socket"), "Test requires a running API server") def test_save_1(self): - """blueprints push""" - rc = blueprints_push("/run/weldr/api.socket", 0, ["example-http-server.toml"], show_json=False) + """blueprints delete example-development""" + rc = blueprints_delete("/run/weldr/api.socket", 0, ["example-development"], show_json=False) self.assertTrue(rc == 0) @unittest.skipUnless(os.path.exists("/run/weldr/api.socket"), "Test requires a running API server") - def test_delete(self): - """blueprints delete""" - rc = blueprints_delete("/run/weldr/api.socket", 0, ["example-development"], show_json=False) + def test_save_2(self): + """blueprints push example-development""" + rc = blueprints_push("/run/weldr/api.socket", 0, ["example-development.toml"], show_json=False) self.assertTrue(rc == 0) @unittest.skipUnless(os.path.exists("/run/weldr/api.socket"), "Test requires a running API server") diff --git a/tests/pylorax/repos/single.repo b/tests/pylorax/repos/single.repo index c4518a01..4bff4670 100644 --- a/tests/pylorax/repos/single.repo +++ b/tests/pylorax/repos/single.repo @@ -7,5 +7,5 @@ metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-single-repo-test skip_if_unavailable=False diff --git a/tests/pylorax/test_projects.py b/tests/pylorax/test_projects.py index a954e141..aabf1e92 100644 --- a/tests/pylorax/test_projects.py +++ b/tests/pylorax/test_projects.py @@ -296,7 +296,7 @@ def singlerepo(): "check_gpg": True, "check_ssl": True, "gpgkey_urls": [ - "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64" + "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-single-repo-test" ], "name": "single-repo", "system": False,