Remove repos.git related tests
Support is not included in this patchset.
(cherry picked from commit a643522769
)
Related: rhbz#1718473
This commit is contained in:
parent
39f464d46b
commit
406dddafef
@ -39,7 +39,6 @@ diff_entries = [{'new': {'Description': 'Shiny new description'}, 'old': {'Descr
|
||||
{"new": {"Customizations.sshkey": [{"key": "ssh-rsa AAAAB3NzaC1... norm@localhost.localdomain", "user": "norm" }]}, "old": None},
|
||||
{"new": {"Customizations.timezone": {"ntpservers": ["ntp.nowhere.com" ], "timezone": "PST8PDT"}}, "old": None},
|
||||
{"new": {"Customizations.user": [{"key": "ssh-rsa AAAAB3NzaC1... root@localhost.localdomain", "name": "root", "password": "fobarfobar"}]}, "old": None},
|
||||
{"new": {"Repos.git": {"destination": "/opt/server-1/", "ref": "v1.0", "repo": "PATH OF GIT REPO TO CLONE", "rpmname": "server-config", "rpmrelease": "2", "rpmversion": "1.0", "summary": "Setup files for server deployment"}}, "old": None},
|
||||
# Removed items (just reversed old/old from above block)
|
||||
{"old": {"Group": {"name": "core"}}, "new": None},
|
||||
{"old": {"Customizations.firewall": {"ports": ["8888:tcp", "22:tcp", "dns:udp", "9090:tcp"], "services": ["smtp"]}}, "new": None},
|
||||
@ -48,7 +47,6 @@ diff_entries = [{'new': {'Description': 'Shiny new description'}, 'old': {'Descr
|
||||
{"old": {"Customizations.sshkey": [{"key": "ssh-rsa AAAAB3NzaC1... norm@localhost.localdomain", "user": "norm" }]}, "new": None},
|
||||
{"old": {"Customizations.timezone": {"ntpservers": ["ntp.nowhere.com" ], "timezone": "PST8PDT"}}, "new": None},
|
||||
{"old": {"Customizations.user": [{"key": "ssh-rsa AAAAB3NzaC1... root@localhost.localdomain", "name": "root", "password": "fobarfobar"}]}, "new": None},
|
||||
{"old": {"Repos.git": {"destination": "/opt/server-1/", "ref": "v1.0", "repo": "PATH OF GIT REPO TO CLONE", "rpmname": "server-config", "rpmrelease": "2", "rpmversion": "1.0", "summary": "Setup files for server deployment"}}, "new": None},
|
||||
# Changed items
|
||||
{"old": {"Customizations.firewall": {"ports": ["8888:tcp", "22:tcp", "dns:udp", "9090:tcp"], "services": ["smtp"]}}, "new": {"Customizations.firewall": {"ports": ["8888:tcp", "22:tcp", "25:tcp"]}}},
|
||||
{"old": {"Customizations.hostname": "foobar"}, "new": {"Customizations.hostname": "grues"}},
|
||||
@ -56,7 +54,6 @@ diff_entries = [{'new': {'Description': 'Shiny new description'}, 'old': {'Descr
|
||||
{"old": {"Customizations.sshkey": [{"key": "ssh-rsa AAAAB3NzaC1... norm@localhost.localdomain", "user": "norm" }]}, "new": {"Customizations.sshkey": [{"key": "ssh-rsa ABCDEF01234... norm@localhost.localdomain", "user": "norm" }]}},
|
||||
{"old": {"Customizations.timezone": {"ntpservers": ["ntp.nowhere.com" ], "timezone": "PST8PDT"}}, "new": {"Customizations.timezone": {"timezone": "Antarctica/Palmer"}}},
|
||||
{"old": {"Customizations.user": [{"key": "ssh-rsa AAAAB3NzaC1... root@localhost.localdomain", "name": "root", "password": "fobarfobar"}]}, "new": {"Customizations.user": [{"key": "ssh-rsa AAAAB3NzaC1... root@localhost.localdomain", "name": "root", "password": "qweqweqwe"}]}},
|
||||
{"old": {"Repos.git": {"destination": "/opt/server-1/", "ref": "v1.0", "repo": "PATH OF GIT REPO TO CLONE", "rpmname": "server-config", "rpmrelease": "2", "rpmversion": "1.0", "summary": "Setup files for server deployment"}}, "new": {"Repos.git": {"destination": "/opt/server-1/", "ref": "v1.0", "repo": "PATH OF GIT REPO TO CLONE", "rpmname": "server-config", "rpmrelease": "1", "rpmversion": "1.1", "summary": "Setup files for server deployment"}}}
|
||||
]
|
||||
|
||||
diff_result = [
|
||||
@ -73,7 +70,6 @@ diff_result = [
|
||||
'Added Customizations.sshkey norm',
|
||||
'Added Customizations.timezone ntpservers="ntp.nowhere.com" timezone="PST8PDT"',
|
||||
'Added Customizations.user root',
|
||||
'Added Repos.git destination="/opt/server-1/" ref="v1.0" repo="PATH OF GIT REPO TO CLONE" rpmname="server-config" rpmrelease="2" rpmversion="1.0" summary="Setup files for server deployment"',
|
||||
'Removed Group core',
|
||||
'Removed Customizations.firewall ports="8888:tcp, 22:tcp, dns:udp, 9090:tcp" services="smtp"',
|
||||
'Removed Customizations.hostname foobar',
|
||||
@ -81,24 +77,20 @@ diff_result = [
|
||||
'Removed Customizations.sshkey norm',
|
||||
'Removed Customizations.timezone ntpservers="ntp.nowhere.com" timezone="PST8PDT"',
|
||||
'Removed Customizations.user root',
|
||||
'Removed Repos.git destination="/opt/server-1/" ref="v1.0" repo="PATH OF GIT REPO TO CLONE" rpmname="server-config" rpmrelease="2" rpmversion="1.0" summary="Setup files for server deployment"',
|
||||
'Changed Customizations.firewall ports="8888:tcp, 22:tcp, dns:udp, 9090:tcp" services="smtp" -> ports="8888:tcp, 22:tcp, 25:tcp"',
|
||||
'Changed Customizations.hostname foobar -> grues',
|
||||
'Changed Customizations.locale keyboard="US" -> keyboard="US" languages="en_US.UTF-8"',
|
||||
'Changed Customizations.sshkey norm -> norm',
|
||||
'Changed Customizations.timezone ntpservers="ntp.nowhere.com" timezone="PST8PDT" -> timezone="Antarctica/Palmer"',
|
||||
'Changed Customizations.user root -> root',
|
||||
'Changed Repos.git destination="/opt/server-1/" ref="v1.0" repo="PATH OF GIT REPO TO CLONE" rpmname="server-config" rpmrelease="2" rpmversion="1.0" summary="Setup files for server deployment" -> destination="/opt/server-1/" ref="v1.0" repo="PATH OF GIT REPO TO CLONE" rpmname="server-config" rpmrelease="1" rpmversion="1.1" summary="Setup files for server deployment"',
|
||||
]
|
||||
|
||||
dict_entries = [{"ports": ["8888:tcp", "22:tcp", "dns:udp", "9090:tcp"]},
|
||||
{"ports": ["8888:tcp", "22:tcp", "dns:udp", "9090:tcp"], "services": ["smtp"]},
|
||||
{ "destination": "/opt/server-1/", "ref": "v1.0", "repo": "PATH OF GIT REPO TO CLONE", "rpmname": "server-config", "rpmrelease": "1", "rpmversion": "1.0", "summary": "Setup files for server deployment" },
|
||||
{"foo": ["one", "two"], "bar": {"baz": "three"}}]
|
||||
|
||||
dict_results = ['ports="8888:tcp, 22:tcp, dns:udp, 9090:tcp"',
|
||||
'ports="8888:tcp, 22:tcp, dns:udp, 9090:tcp" services="smtp"',
|
||||
'destination="/opt/server-1/" ref="v1.0" repo="PATH OF GIT REPO TO CLONE" rpmname="server-config" rpmrelease="1" rpmversion="1.0" summary="Setup files for server deployment"',
|
||||
'foo="one, two"']
|
||||
|
||||
dict_name_entry1 = [{"name": "bart", "home": "Springfield"},
|
||||
|
@ -1 +1 @@
|
||||
{'name': 'custom-base', 'description': 'A base system with customizations', 'version': '0.0.1', 'modules': [], 'packages': [{'name': 'bash', 'version': '5.0.*'}], 'groups': [], 'customizations': {'hostname': 'custombase', 'sshkey': [{'user': 'root', 'key': 'A SSH KEY FOR ROOT'}], 'kernel': {'append': 'nosmt=force'}, 'user': [{'name': 'admin', 'description': 'Administrator account', 'password': '$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L...', 'key': 'PUBLIC SSH KEY', 'home': '/srv/widget/', 'shell': '/usr/bin/bash', 'groups': ['widget', 'users', 'wheel'], 'uid': 1200, 'gid': 1200}], 'group': [{'name': 'widget', 'gid': 1130}], 'timezone': {'timezone': 'US/Eastern', 'ntpservers': ['0.north-america.pool.ntp.org', '1.north-america.pool.ntp.org']}, 'locale': {'languages': ['en_US.UTF-8'], 'keyboard': 'us'}, 'firewall': {'ports': ['22:tcp', '80:tcp', 'imap:tcp', '53:tcp', '53:udp'], 'services': {'enabled': ['ftp', 'ntp', 'dhcp'], 'disabled': ['telnet']}}, 'services': {'enabled': ['sshd', 'cockpit.socket', 'httpd'], 'disabled': ['postfix', 'telnetd']}}}
|
||||
{'name': 'custom-base', 'description': 'A base system with customizations', 'version': '0.0.1', 'modules': [], 'packages': [{'name': 'bash', 'version': '4.4.*'}], 'groups': [], 'customizations': {'hostname': 'custombase', 'sshkey': [{'user': 'root', 'key': 'A SSH KEY FOR ROOT'}], 'kernel': {'append': 'nosmt=force'}, 'user': [{'name': 'admin', 'description': 'Administrator account', 'password': '$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L...', 'key': 'PUBLIC SSH KEY', 'home': '/srv/widget/', 'shell': '/usr/bin/bash', 'groups': ['widget', 'users', 'wheel'], 'uid': 1200, 'gid': 1200}], 'group': [{'name': 'widget', 'gid': 1130}], 'timezone': {'timezone': 'US/Eastern', 'ntpservers': ['0.north-america.pool.ntp.org', '1.north-america.pool.ntp.org']}, 'locale': {'languages': ['en_US.UTF-8'], 'keyboard': 'us'}, 'firewall': {'ports': ['22:tcp', '80:tcp', 'imap:tcp', '53:tcp', '53:udp'], 'services': {'enabled': ['ftp', 'ntp', 'dhcp'], 'disabled': ['telnet']}}, 'services': {'enabled': ['sshd', 'cockpit.socket', 'httpd'], 'disabled': ['postfix', 'telnetd']}}}
|
||||
|
@ -126,36 +126,6 @@ class BasicRecipeTest(unittest.TestCase):
|
||||
'password': '$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L...', 'shell': '/usr/bin/bash', 'uid': 1200}]},
|
||||
'old': None}]
|
||||
|
||||
# repos.git test data and results
|
||||
self.old_git = [{'rpmname': 'server-config-files',
|
||||
'rpmversion': '1.0',
|
||||
'rpmrelease': '1',
|
||||
'summary': 'Setup files for server deployment',
|
||||
'repo': 'https://github.com/weldr/server-config-files',
|
||||
'ref': 'v3.0',
|
||||
'destination': '/srv/config/'}]
|
||||
self.new_git = [{'rpmname': 'bart-files',
|
||||
'rpmversion': '1.1',
|
||||
'rpmrelease': '1',
|
||||
'summary': 'Files needed for Bart',
|
||||
'repo': 'https://github.com/weldr/not-a-real-repo',
|
||||
'ref': 'v1.0',
|
||||
'destination': '/home/bart/Documents/'},
|
||||
{'rpmname': 'server-config-files',
|
||||
'rpmversion': '1.0',
|
||||
'rpmrelease': '1',
|
||||
'summary': 'Setup files for server deployment',
|
||||
'repo': 'https://github.com/weldr/server-config-files',
|
||||
'ref': 'v3.0',
|
||||
'destination': '/srv/config/'}]
|
||||
self.git_result = [{'old': None,
|
||||
'new': {'Repos.git': {'rpmname': 'bart-files',
|
||||
'rpmversion': '1.1',
|
||||
'rpmrelease': '1',
|
||||
'summary': 'Files needed for Bart',
|
||||
'repo': 'https://github.com/weldr/not-a-real-repo',
|
||||
'ref': 'v1.0',
|
||||
'destination': '/home/bart/Documents/'}}}]
|
||||
self.maxDiff = None
|
||||
|
||||
@classmethod
|
||||
@ -249,8 +219,6 @@ class BasicRecipeTest(unittest.TestCase):
|
||||
self.assertEqual(recipes.diff_lists("Modules", "name", self.old_modules, self.new_modules), self.modules_result)
|
||||
self.assertEqual(recipes.diff_lists("Packages", "name", self.old_packages, self.new_packages), self.packages_result)
|
||||
self.assertEqual(recipes.diff_lists("Groups", "name", self.old_groups, self.new_groups), self.groups_result)
|
||||
self.assertEqual(recipes.diff_lists("Repos.git", "rpmname", self.old_git, self.new_git), self.git_result)
|
||||
self.assertEqual(recipes.diff_lists("Repos.git", "rpmname", self.old_git, sorted(self.new_git, reverse=True, key=lambda o: o["rpmname"].lower())), self.git_result)
|
||||
|
||||
def customizations_diff_test(self):
|
||||
"""Test the customizations_diff function"""
|
||||
@ -526,69 +494,35 @@ class BasicRecipeTest(unittest.TestCase):
|
||||
|
||||
def recipe_diff_test(self):
|
||||
"""Test the recipe_diff function"""
|
||||
old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.1.1", self.old_modules, self.old_packages, [], gitrepos=self.old_git)
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [], gitrepos=self.new_git)
|
||||
result = [{'new': {'Version': '0.3.1'}, 'old': {'Version': '0.1.1'}},
|
||||
{'new': {'Module': {'name': 'openssh', 'version': '2.8.1'}}, 'old': None},
|
||||
{'new': None, 'old': {'Module': {'name': 'bash', 'version': '5.*'}}},
|
||||
{'new': {'Module': {'name': 'httpd', 'version': '3.8.*'}},
|
||||
'old': {'Module': {'name': 'httpd', 'version': '3.7.*'}}},
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None},
|
||||
{'new': {'Repos.git': {'destination': '/home/bart/Documents/',
|
||||
'ref': 'v1.0',
|
||||
'repo': 'https://github.com/weldr/not-a-real-repo',
|
||||
'rpmname': 'bart-files',
|
||||
'rpmrelease': '1',
|
||||
'rpmversion': '1.1',
|
||||
'summary': 'Files needed for Bart'}},
|
||||
'old': None}]
|
||||
self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
|
||||
|
||||
# Empty starting recipe
|
||||
old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.1.1", [], self.old_packages, [], gitrepos=self.old_git)
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [], gitrepos=self.new_git)
|
||||
result = [{'new': {'Version': '0.3.1'}, 'old': {'Version': '0.1.1'}},
|
||||
{'new': {'Module': {'name': 'httpd', 'version': '3.8.*'}}, 'old': None},
|
||||
{'new': {'Module': {'name': 'openssh', 'version': '2.8.1'}}, 'old': None},
|
||||
{'new': {'Module': {'name': 'toml', 'version': '2.1'}}, 'old': None},
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None},
|
||||
{'new': {'Repos.git': {'destination': '/home/bart/Documents/',
|
||||
'ref': 'v1.0',
|
||||
'repo': 'https://github.com/weldr/not-a-real-repo',
|
||||
'rpmname': 'bart-files',
|
||||
'rpmrelease': '1',
|
||||
'rpmversion': '1.1',
|
||||
'summary': 'Files needed for Bart'}},
|
||||
'old': None}]
|
||||
self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
|
||||
|
||||
# All new git repos
|
||||
old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.1.1", self.old_modules, self.old_packages, [])
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [], gitrepos=self.new_git)
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [])
|
||||
result = [{'new': {'Version': '0.3.1'}, 'old': {'Version': '0.1.1'}},
|
||||
{'new': {'Module': {'name': 'openssh', 'version': '2.8.1'}}, 'old': None},
|
||||
{'new': None, 'old': {'Module': {'name': 'bash', 'version': '4.*'}}},
|
||||
{'new': {'Module': {'name': 'httpd', 'version': '3.8.*'}},
|
||||
'old': {'Module': {'name': 'httpd', 'version': '3.7.*'}}},
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None},
|
||||
{'new': {'Repos.git': {'destination': '/home/bart/Documents/',
|
||||
'ref': 'v1.0',
|
||||
'repo': 'https://github.com/weldr/not-a-real-repo',
|
||||
'rpmname': 'bart-files',
|
||||
'rpmrelease': '1',
|
||||
'rpmversion': '1.1',
|
||||
'summary': 'Files needed for Bart'}},
|
||||
'old': None},
|
||||
{'new': {'Repos.git': {'destination': '/srv/config/',
|
||||
'ref': 'v3.0',
|
||||
'repo': 'https://github.com/weldr/server-config-files',
|
||||
'rpmname': 'server-config-files',
|
||||
'rpmrelease': '1',
|
||||
'rpmversion': '1.0',
|
||||
'summary': 'Setup files for server deployment'}},
|
||||
'old': None}]
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None}]
|
||||
self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
|
||||
|
||||
# Empty starting recipe
|
||||
old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.1.1", [], self.old_packages, [])
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [])
|
||||
result = [{'new': {'Version': '0.3.1'}, 'old': {'Version': '0.1.1'}},
|
||||
{'new': {'Module': {'name': 'httpd', 'version': '3.8.*'}}, 'old': None},
|
||||
{'new': {'Module': {'name': 'openssh', 'version': '2.8.1'}}, 'old': None},
|
||||
{'new': {'Module': {'name': 'toml', 'version': '2.1'}}, 'old': None},
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None}]
|
||||
self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
|
||||
|
||||
# All new git repos
|
||||
old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.1.1", self.old_modules, self.old_packages, [])
|
||||
new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing", "0.3.1", self.new_modules, self.new_packages, [])
|
||||
result = [{'new': {'Version': '0.3.1'}, 'old': {'Version': '0.1.1'}},
|
||||
{'new': {'Module': {'name': 'openssh', 'version': '2.8.1'}}, 'old': None},
|
||||
{'new': None, 'old': {'Module': {'name': 'bash', 'version': '4.*'}}},
|
||||
{'new': {'Module': {'name': 'httpd', 'version': '3.8.*'}},
|
||||
'old': {'Module': {'name': 'httpd', 'version': '3.7.*'}}},
|
||||
{'new': {'Package': {'name': 'git', 'version': '2.13.*'}}, 'old': None}]
|
||||
self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
|
||||
|
||||
class GitRecipesTest(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user