Merge lp:~allenap/maas/test-decompose-machine--bug-1663517 into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 5713
Proposed branch: lp:~allenap/maas/test-decompose-machine--bug-1663517
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 71 lines (+16/-2)
1 file modified
src/provisioningserver/rpc/tests/test_clusterservice.py (+16/-2)
To merge this branch: bzr merge lp:~allenap/maas/test-decompose-machine--bug-1663517
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+316928@code.launchpad.net

Commit message

Run test_calls_decompose_machine in a Twisted-aware runner, and fix.

Run all other clusterservice tests in a Twisted-aware runner too.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/provisioningserver/rpc/tests/test_clusterservice.py'
--- src/provisioningserver/rpc/tests/test_clusterservice.py 2017-02-08 14:39:19 +0000
+++ src/provisioningserver/rpc/tests/test_clusterservice.py 2017-02-10 09:05:22 +0000
@@ -169,6 +169,8 @@
169169
170class TestClusterProtocol_Authenticate(MAASTestCase):170class TestClusterProtocol_Authenticate(MAASTestCase):
171171
172 run_tests_with = MAASTwistedRunTest.make_factory(timeout=5)
173
172 def test_authenticate_is_registered(self):174 def test_authenticate_is_registered(self):
173 protocol = Cluster()175 protocol = Cluster()
174 responder = protocol.locateResponder(cluster.Authenticate.commandName)176 responder = protocol.locateResponder(cluster.Authenticate.commandName)
@@ -864,6 +866,8 @@
864 }),866 }),
865 )867 )
866868
869 run_tests_with = MAASTwistedRunTest.make_factory(timeout=5)
870
867 def make_inert_client_service(self):871 def make_inert_client_service(self):
868 service = ClusterClientService(Clock())872 service = ClusterClientService(Clock())
869 # ClusterClientService's superclass, TimerService, creates a873 # ClusterClientService's superclass, TimerService, creates a
@@ -2382,6 +2386,8 @@
23822386
2383class TestClusterProtocol_AddChassis(MAASTestCase):2387class TestClusterProtocol_AddChassis(MAASTestCase):
23842388
2389 run_tests_with = MAASTwistedRunTest.make_factory(timeout=5)
2390
2385 def test__is_registered(self):2391 def test__is_registered(self):
2386 protocol = Cluster()2392 protocol = Cluster()
2387 responder = protocol.locateResponder(2393 responder = protocol.locateResponder(
@@ -2760,6 +2766,8 @@
27602766
2761class TestClusterProtocol_DiscoverPod(MAASTestCase):2767class TestClusterProtocol_DiscoverPod(MAASTestCase):
27622768
2769 run_tests_with = MAASTwistedRunTest.make_factory(timeout=5)
2770
2763 def test__is_registered(self):2771 def test__is_registered(self):
2764 protocol = Cluster()2772 protocol = Cluster()
2765 responder = protocol.locateResponder(2773 responder = protocol.locateResponder(
@@ -2851,23 +2859,29 @@
28512859
2852class TestClusterProtocol_DecomposeMachine(MAASTestCase):2860class TestClusterProtocol_DecomposeMachine(MAASTestCase):
28532861
2862 run_tests_with = MAASTwistedRunTest.make_factory(timeout=5)
2863
2854 def test__is_registered(self):2864 def test__is_registered(self):
2855 protocol = Cluster()2865 protocol = Cluster()
2856 responder = protocol.locateResponder(2866 responder = protocol.locateResponder(
2857 cluster.DecomposeMachine.commandName)2867 cluster.DecomposeMachine.commandName)
2858 self.assertIsNotNone(responder)2868 self.assertIsNotNone(responder)
28592869
2870 @inlineCallbacks
2860 def test_calls_decompose_machine(self):2871 def test_calls_decompose_machine(self):
2861 mock_decompose_machine = self.patch_autospec(2872 mock_decompose_machine = self.patch_autospec(
2862 pods, 'decompose_machine')2873 pods, 'decompose_machine')
2863 mock_decompose_machine.return_value = succeed({})2874 mock_decompose_machine.return_value = succeed({
2875 "hints": DiscoveredPodHints(
2876 cores=1, cpu_speed=2, memory=3, local_storage=4),
2877 })
2864 pod_type = factory.make_name('pod_type')2878 pod_type = factory.make_name('pod_type')
2865 context = {2879 context = {
2866 "data": factory.make_name("data"),2880 "data": factory.make_name("data"),
2867 }2881 }
2868 pod_id = random.randint(1, 100)2882 pod_id = random.randint(1, 100)
2869 name = factory.make_name('pod')2883 name = factory.make_name('pod')
2870 call_responder(Cluster(), cluster.DecomposeMachine, {2884 yield call_responder(Cluster(), cluster.DecomposeMachine, {
2871 'type': pod_type,2885 'type': pod_type,
2872 'context': context,2886 'context': context,
2873 'pod_id': pod_id,2887 'pod_id': pod_id,