From b6b4e2357feb2c83b3e4c46117d6baa3c54018ce Mon Sep 17 00:00:00 2001 From: Adam Collard Date: Tue, 11 Aug 2015 14:59:31 +0100 Subject: [PATCH] SWIFT_SVCS was an out of date list of services that the charm starts, redefine it in terms of the individual components of account, container and object. Update tests. --- lib/swift_storage_utils.py | 16 +----------- unit_tests/test_actions.py | 52 +++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/lib/swift_storage_utils.py b/lib/swift_storage_utils.py index 43a62b9..682ffe8 100644 --- a/lib/swift_storage_utils.py +++ b/lib/swift_storage_utils.py @@ -83,21 +83,7 @@ OBJECT_SVCS = [ 'swift-object-updater', 'swift-object-replicator' ] -SWIFT_SVCS = [ - 'swift-account-auditor', - 'swift-account-reaper', - 'swift-account-replicator', - 'swift-account-server', - 'swift-container-auditor', - 'swift-container-replicator', - 'swift-container-server', - 'swift-container-sync', - 'swift-container-updater', - 'swift-object-auditor', - 'swift-object-replicator', - 'swift-object-server', - 'swift-object-updater', - ] +SWIFT_SVCS = ACCOUNT_SVCS + CONTAINER_SVCS + OBJECT_SVCS RESTART_MAP = { '/etc/rsync-juju.d/050-swift-storage.conf': ['rsync'], diff --git a/unit_tests/test_actions.py b/unit_tests/test_actions.py index f78629e..d830fc0 100644 --- a/unit_tests/test_actions.py +++ b/unit_tests/test_actions.py @@ -26,26 +26,26 @@ class PauseTestCase(CharmTestCase): self.service_pause.side_effect = fake_service_pause actions.actions.pause([]) - self.assertEqual(pause_calls, ['swift-account-auditor', + self.assertEqual(pause_calls, ['swift-account', + 'swift-account-auditor', 'swift-account-reaper', 'swift-account-replicator', - 'swift-account-server', + 'swift-container', 'swift-container-auditor', - 'swift-container-replicator', - 'swift-container-server', - 'swift-container-sync', 'swift-container-updater', + 'swift-container-replicator', + 'swift-container-sync', + 'swift-object', 'swift-object-auditor', - 'swift-object-replicator', - 'swift-object-server', - 'swift-object-updater']) + 'swift-object-updater', + 'swift-object-replicator']) def test_bails_out_early_on_error(self): """Pause action fails early if there are errors stopping a service.""" pause_calls = [] def maybe_kill(svc): - if svc == "swift-container-auditor": + if svc == "swift-container": return False else: pause_calls.append(svc) @@ -53,12 +53,12 @@ class PauseTestCase(CharmTestCase): self.service_pause.side_effect = maybe_kill self.assertRaisesRegexp( - Exception, "swift-container-auditor didn't stop cleanly.", + Exception, "swift-container didn't stop cleanly.", actions.actions.pause, []) - self.assertEqual(pause_calls, ['swift-account-auditor', + self.assertEqual(pause_calls, ['swift-account', + 'swift-account-auditor', 'swift-account-reaper', - 'swift-account-replicator', - 'swift-account-server']) + 'swift-account-replicator']) def test_status_mode(self): """Pause action sets the status to maintenance.""" @@ -97,26 +97,26 @@ class ResumeTestCase(CharmTestCase): self.service_resume.side_effect = fake_service_resume actions.actions.resume([]) - self.assertEqual(resume_calls, ['swift-account-auditor', + self.assertEqual(resume_calls, ['swift-account', + 'swift-account-auditor', 'swift-account-reaper', 'swift-account-replicator', - 'swift-account-server', + 'swift-container', 'swift-container-auditor', - 'swift-container-replicator', - 'swift-container-server', - 'swift-container-sync', 'swift-container-updater', + 'swift-container-replicator', + 'swift-container-sync', + 'swift-object', 'swift-object-auditor', - 'swift-object-replicator', - 'swift-object-server', - 'swift-object-updater']) + 'swift-object-updater', + 'swift-object-replicator']) def test_bails_out_early_on_error(self): """Resume action fails early if there are errors starting a service.""" resume_calls = [] def maybe_kill(svc): - if svc == "swift-container-auditor": + if svc == "swift-container": return False else: resume_calls.append(svc) @@ -124,12 +124,12 @@ class ResumeTestCase(CharmTestCase): self.service_resume.side_effect = maybe_kill self.assertRaisesRegexp( - Exception, "swift-container-auditor didn't start cleanly.", + Exception, "swift-container didn't start cleanly.", actions.actions.resume, []) - self.assertEqual(resume_calls, ['swift-account-auditor', + self.assertEqual(resume_calls, ['swift-account', + 'swift-account-auditor', 'swift-account-reaper', - 'swift-account-replicator', - 'swift-account-server']) + 'swift-account-replicator']) def test_status_mode(self): """Resume action sets the status to maintenance."""