launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08180
[Merge] lp:~rvb/maas/power-broken-build into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/power-broken-build into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rvb/maas/power-broken-build/+merge/107201
This branch fixes some of the tests which are failing because of the new code in src/maasserver/models/__init__.py.start_nodes (changed in https://code.launchpad.net/~julian-edwards/maas/pass-power-params/+merge/107163). A node now needs to have power_type set up properly to be started.
I also fixed some lint while I was at it.
--
https://code.launchpad.net/~rvb/maas/power-broken-build/+merge/107201
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/power-broken-build into lp:maas.
=== modified file 'src/maasserver/models/__init__.py'
--- src/maasserver/models/__init__.py 2012-05-24 09:41:34 +0000
+++ src/maasserver/models/__init__.py 2012-05-24 11:57:18 +0000
@@ -363,7 +363,7 @@
try:
macaddress = node.macaddress_set.order_by('created')[0]
except IndexError:
- pass # No MAC recorded for this node.
+ pass # No MAC recorded for this node.
else:
mac = macaddress.mac_address
if mac is not None and mac != "":
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-05-23 16:32:15 +0000
+++ src/maasserver/tests/test_api.py 2012-05-24 11:57:18 +0000
@@ -690,7 +690,9 @@
node.system_id, json.loads(response.content)['system_id'])
def test_POST_stop_may_be_repeated(self):
- node = factory.make_node(owner=self.logged_in_user)
+ node = factory.make_node(
+ owner=self.logged_in_user, mac=True,
+ power_type=POWER_TYPE.WAKE_ON_LAN)
self.client.post(self.get_node_uri(node), {'op': 'stop'})
response = self.client.post(self.get_node_uri(node), {'op': 'stop'})
self.assertEqual(httplib.OK, response.status_code)
@@ -701,20 +703,26 @@
self.assertEqual(httplib.FORBIDDEN, response.status_code)
def test_POST_start_returns_node(self):
- node = factory.make_node(owner=self.logged_in_user, mac=True)
+ node = factory.make_node(
+ owner=self.logged_in_user, mac=True,
+ power_type=POWER_TYPE.WAKE_ON_LAN)
response = self.client.post(self.get_node_uri(node), {'op': 'start'})
self.assertEqual(httplib.OK, response.status_code)
self.assertEqual(
node.system_id, json.loads(response.content)['system_id'])
def test_POST_start_may_be_repeated(self):
- node = factory.make_node(owner=self.logged_in_user, mac=True)
+ node = factory.make_node(
+ owner=self.logged_in_user, mac=True,
+ power_type=POWER_TYPE.WAKE_ON_LAN)
self.client.post(self.get_node_uri(node), {'op': 'start'})
response = self.client.post(self.get_node_uri(node), {'op': 'start'})
self.assertEqual(httplib.OK, response.status_code)
def test_POST_start_stores_user_data(self):
- node = factory.make_node(owner=self.logged_in_user, mac=True)
+ node = factory.make_node(
+ owner=self.logged_in_user, mac=True,
+ power_type=POWER_TYPE.WAKE_ON_LAN)
user_data = (
b'\xff\x00\xff\xfe\xff\xff\xfe' +
factory.getRandomString().encode('ascii'))
=== modified file 'src/maasserver/tests/test_models.py'
--- src/maasserver/tests/test_models.py 2012-05-24 09:41:34 +0000
+++ src/maasserver/tests/test_models.py 2012-05-24 11:57:18 +0000
@@ -721,6 +721,7 @@
power_parameters=dict(jarjar="binks"))
output = Node.objects.start_nodes([node.system_id], user)
self.assertItemsEqual([], output)
+ self.assertEqual([], fixture.tasks)
def test_start_nodes_wakeonlan_ignores_empty_mac_parameter(self):
fixture = self.useFixture(CeleryFixture())
@@ -730,7 +731,7 @@
power_parameters=dict(mac=""))
output = Node.objects.start_nodes([node.system_id], user)
self.assertItemsEqual([], output)
- self.assertEqual(0, len(fixture.tasks))
+ self.assertEqual([], fixture.tasks)
def test_start_nodes_other_power_type(self):
# wakeonlan tests, above, are a special case. Test another type