tests: Make it easier to update version globs

Use constants so we won't have to edit a dozen places in the test when
the package versions are bumped.

Also switch to using Fedora 31 GPG key now that it has branched for
Fedora 30.
This commit is contained in:
Brian C. Lane 2019-03-08 10:09:42 -08:00
parent eef11ef405
commit e39d2aec22
3 changed files with 73 additions and 58 deletions

View File

@ -3,11 +3,11 @@ description = "An example GlusterFS server with samba"
[[modules]] [[modules]]
name = "glusterfs" name = "glusterfs"
version = "5.*" version = "6.*"
[[modules]] [[modules]]
name = "glusterfs-cli" name = "glusterfs-cli"
version = "5.*" version = "6.*"
[[packages]] [[packages]]
name = "samba" name = "samba"

View File

@ -291,7 +291,7 @@ def singlerepo():
"check_gpg": True, "check_gpg": True,
"check_ssl": True, "check_ssl": True,
"gpgkey_urls": [ "gpgkey_urls": [
"file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-30-x86_64" "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-31-x86_64"
], ],
"name": "single-repo", "name": "single-repo",
"system": False, "system": False,

View File

@ -39,6 +39,21 @@ from pylorax.sysutils import joinpaths
# Used for testing UTF-8 input support # Used for testing UTF-8 input support
UTF8_TEST_STRING = "I 𝒊ll 𝟉ο𝘁 𝛠𝔰 𝘁𝒉𝝸𝚜" UTF8_TEST_STRING = "I 𝒊ll 𝟉ο𝘁 𝛠𝔰 𝘁𝒉𝝸𝚜"
# HELPER CONSTANTS
HTTP_GLOB = {"name":"httpd", "version":"2.4.*"}
OPENID_GLOB = {"name":"mod_auth_openid", "version":"0.8"}
MODSSL_GLOB = {"name":"mod_ssl", "version":"2.4.*"}
PHP_GLOB = {"name":"php", "version":"7.*"}
PHPMYSQL_GLOB = {"name": "php-mysqlnd", "version":"7.*"}
OPENSSH_GLOB = {"name":"openssh-server", "version": "7.*"}
RSYNC_GLOB = {"name": "rsync", "version": "3.1.*"}
SAMBA_GLOB = {"name": "samba", "version": "4.*.*"}
TMUX_GLOB = {"name": "tmux", "version": "2.8"}
GLUSTERFS_GLOB = {"name": "glusterfs", "version": "6.*"}
GLUSTERFSCLI_GLOB = {"name": "glusterfs-cli", "version": "6.*"}
def get_system_repo(): def get_system_repo():
"""Get an enabled system repo from /etc/yum.repos.d/*repo """Get an enabled system repo from /etc/yum.repos.d/*repo
@ -160,15 +175,15 @@ class ServerTestCase(unittest.TestCase):
info_dict_1 = {"changes":[{"changed":False, "name":"example-http-server"}], info_dict_1 = {"changes":[{"changed":False, "name":"example-http-server"}],
"errors":[], "errors":[],
"blueprints":[{"description":"An example http server with PHP and MySQL support.", "blueprints":[{"description":"An example http server with PHP and MySQL support.",
"modules":[{"name":"httpd", "version":"2.4.*"}, "modules":[HTTP_GLOB,
{"name":"mod_auth_openid", "version":"0.8"}, OPENID_GLOB,
{"name":"mod_ssl", "version":"2.4.*"}, MODSSL_GLOB,
{"name":"php", "version":"7.*"}, PHP_GLOB,
{"name": "php-mysqlnd", "version":"7.*"}], PHPMYSQL_GLOB],
"name":"example-http-server", "name":"example-http-server",
"packages": [{"name":"openssh-server", "version": "7.*"}, "packages": [OPENSSH_GLOB,
{"name": "rsync", "version": "3.1.*"}, RSYNC_GLOB,
{"name": "tmux", "version": "2.8"}], TMUX_GLOB],
"groups": [], "groups": [],
"version": "0.0.1"}]} "version": "0.0.1"}]}
resp = self.server.get("/api/v0/blueprints/info/example-http-server") resp = self.server.get("/api/v0/blueprints/info/example-http-server")
@ -181,22 +196,22 @@ class ServerTestCase(unittest.TestCase):
{"changed":False, "name":"example-http-server"}], {"changed":False, "name":"example-http-server"}],
"errors":[], "errors":[],
"blueprints":[{"description": "An example GlusterFS server with samba", "blueprints":[{"description": "An example GlusterFS server with samba",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"name":"example-glusterfs", "name":"example-glusterfs",
"packages":[{"name":"samba", "version":"4.*.*"}], "packages":[SAMBA_GLOB],
"groups": [], "groups": [],
"version": "0.0.1"}, "version": "0.0.1"},
{"description":"An example http server with PHP and MySQL support.", {"description":"An example http server with PHP and MySQL support.",
"modules":[{"name":"httpd", "version":"2.4.*"}, "modules":[HTTP_GLOB,
{"name":"mod_auth_openid", "version":"0.8"}, OPENID_GLOB,
{"name":"mod_ssl", "version":"2.4.*"}, MODSSL_GLOB,
{"name":"php", "version":"7.*"}, PHP_GLOB,
{"name": "php-mysqlnd", "version":"7.*"}], PHPMYSQL_GLOB],
"name":"example-http-server", "name":"example-http-server",
"packages": [{"name":"openssh-server", "version": "7.*"}, "packages": [OPENSSH_GLOB,
{"name": "rsync", "version": "3.1.*"}, RSYNC_GLOB,
{"name": "tmux", "version": "2.8"}], TMUX_GLOB],
"groups": [], "groups": [],
"version": "0.0.1"}, "version": "0.0.1"},
]} ]}
@ -245,10 +260,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba", test_blueprint = {"description": "An example GlusterFS server with samba",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "0.2.0", "version": "0.2.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/new", resp = self.server.post("/api/v0/blueprints/new",
@ -296,10 +311,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba, ws version", test_blueprint = {"description": "An example GlusterFS server with samba, ws version",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "0.3.0", "version": "0.3.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/workspace", resp = self.server.post("/api/v0/blueprints/workspace",
@ -323,10 +338,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba, ws version", test_blueprint = {"description": "An example GlusterFS server with samba, ws version",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "0.4.0", "version": "0.4.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/workspace", resp = self.server.post("/api/v0/blueprints/workspace",
@ -373,10 +388,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba, ws version", test_blueprint = {"description": "An example GlusterFS server with samba, ws version",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "1.4.0", "version": "1.4.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/workspace", resp = self.server.post("/api/v0/blueprints/workspace",
data=json.dumps(test_blueprint), data=json.dumps(test_blueprint),
@ -492,10 +507,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba, ws version", test_blueprint = {"description": "An example GlusterFS server with samba, ws version",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "0.3.0", "version": "0.3.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}]} TMUX_GLOB]}
resp = self.server.post("/api/v0/blueprints/workspace", resp = self.server.post("/api/v0/blueprints/workspace",
data=json.dumps(test_blueprint), data=json.dumps(test_blueprint),
@ -774,10 +789,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba", test_blueprint = {"description": "An example GlusterFS server with samba",
"name":"example-glusterfs", "name":"example-glusterfs",
"version": "0.2.0", "version": "0.2.0",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/new?branch=test", resp = self.server.post("/api/v0/blueprints/new?branch=test",
@ -1238,10 +1253,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba", test_blueprint = {"description": "An example GlusterFS server with samba",
"name":UTF8_TEST_STRING, "name":UTF8_TEST_STRING,
"version": "0.2.0", "version": "0.2.0",
"modules":[{"name":"glusterfs", "version":"3.*.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"3.*.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"1.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/new", resp = self.server.post("/api/v0/blueprints/new",
@ -1268,10 +1283,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "An example GlusterFS server with samba, ws version", test_blueprint = {"description": "An example GlusterFS server with samba, ws version",
"name":UTF8_TEST_STRING, "name":UTF8_TEST_STRING,
"version": "0.3.0", "version": "0.3.0",
"modules":[{"name":"glusterfs", "version":"3.*.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"3.*.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"1.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/workspace", resp = self.server.post("/api/v0/blueprints/workspace",
@ -1420,10 +1435,10 @@ class ServerTestCase(unittest.TestCase):
test_blueprint = {"description": "A blueprint that has been deleted", test_blueprint = {"description": "A blueprint that has been deleted",
"name":"deleted-blueprint", "name":"deleted-blueprint",
"version": "0.0.1", "version": "0.0.1",
"modules":[{"name":"glusterfs", "version":"5.*"}, "modules":[GLUSTERFS_GLOB,
{"name":"glusterfs-cli", "version":"5.*"}], GLUSTERFSCLI_GLOB],
"packages":[{"name":"samba", "version":"4.*.*"}, "packages":[SAMBA_GLOB,
{"name":"tmux", "version":"2.8"}], TMUX_GLOB],
"groups": []} "groups": []}
resp = self.server.post("/api/v0/blueprints/new", resp = self.server.post("/api/v0/blueprints/new",