Merge lp:~mpontillo/maas/bug-1537257-triage-1.10 into lp:~maas-committers/maas/trunk

Proposed by Mike Pontillo
Status: Superseded
Proposed branch: lp:~mpontillo/maas/bug-1537257-triage-1.10
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 126 lines (+83/-2) (has conflicts)
2 files modified
required-packages/base (+17/-0)
src/maasserver/tests/test_forms_nodegroup.py (+66/-2)
Text conflict in required-packages/base
To merge this branch: bzr merge lp:~mpontillo/maas/bug-1537257-triage-1.10
Reviewer Review Type Date Requested Status
MAAS Maintainers Pending
Review via email: mp+283884@code.launchpad.net

Commit message

Add unit test for problem described by bug #1537257.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'required-packages/base'
--- required-packages/base 2016-01-19 22:36:17 +0000
+++ required-packages/base 2016-01-26 01:18:12 +0000
@@ -11,6 +11,7 @@
11libjs-jquery11libjs-jquery
12libjs-yui3-min12libjs-yui3-min
13libpq-dev13libpq-dev
14<<<<<<< TREE
14postgresql-9.415postgresql-9.4
15python-bson16python-bson
16python-crochet17python-crochet
@@ -25,6 +26,22 @@
25python-tempita26python-tempita
26python-twisted27python-twisted
27python-yaml28python-yaml
29=======
30postgresql
31python-bson
32python-crochet
33python-django
34python-django-piston
35python-djorm-ext-pgarray
36python-formencode
37python-lxml
38python-netaddr
39python-netifaces
40python-psycopg2
41python-tempita
42python-twisted
43python-yaml
44>>>>>>> MERGE-SOURCE
28python3-apt45python3-apt
29python3-bson46python3-bson
30python3-convoy47python3-convoy
3148
=== modified file 'src/maasserver/tests/test_forms_nodegroup.py'
--- src/maasserver/tests/test_forms_nodegroup.py 2015-12-01 18:12:59 +0000
+++ src/maasserver/tests/test_forms_nodegroup.py 2016-01-26 01:18:12 +0000
@@ -26,7 +26,7 @@
26from maasserver.models import (26from maasserver.models import (
27 NodeGroup,27 NodeGroup,
28 NodeGroupInterface,28 NodeGroupInterface,
29)29 Fabric)
30from maasserver.testing.factory import factory30from maasserver.testing.factory import factory
31from maasserver.testing.orm import reload_object31from maasserver.testing.orm import reload_object
32from maasserver.testing.testcase import MAASServerTestCase32from maasserver.testing.testcase import MAASServerTestCase
@@ -36,7 +36,7 @@
36 HasLength,36 HasLength,
37 MatchesStructure,37 MatchesStructure,
38 StartsWith,38 StartsWith,
39)39 Equals)
4040
4141
42class TestNodeGroupDefineForm(MAASServerTestCase):42class TestNodeGroupDefineForm(MAASServerTestCase):
@@ -348,6 +348,70 @@
348 ipv4_network,348 ipv4_network,
349 interfaces_by_name[network_interface].network)349 interfaces_by_name[network_interface].network)
350350
351 def test_creates_appropriate_fabric_layout(self):
352 name = factory.make_name('name')
353 uuid = factory.make_UUID()
354 interfaces = [
355 {'interface': 'bond0',
356 'ip': '92.140.99.3',
357 'subnet_mask': '255.255.255.0'},
358 {'interface': 'bond0.100',
359 'ip': '92.140.100.3',
360 'subnet_mask': '255.255.255.0'},
361 {'interface': 'bond0.101',
362 'ip': '92.140.101.3',
363 'subnet_mask': '255.255.255.0'},
364 {'interface': 'bond0.102',
365 'ip': '92.140.102.3',
366 'subnet_mask': '255.255.255.0'},
367 {'interface': 'bond0.103',
368 'ip': '92.140.103.3',
369 'subnet_mask': '255.255.255.0'},
370 {'interface': 'bond1',
371 'ip': '78.146.99.12',
372 'subnet_mask': '255.255.255.0'},
373 {'interface': 'bond1.200',
374 'ip': '78.146.200.12',
375 'subnet_mask': '255.255.255.0'},
376 {'interface': 'bond1.201',
377 'ip': '78.146.201.12',
378 'subnet_mask': '255.255.255.0'},
379 {'interface': 'bond1.202',
380 'ip': '78.146.202.12',
381 'subnet_mask': '255.255.255.0'},
382 {'interface': 'bond1.203',
383 'ip': '78.146.203.12',
384 'subnet_mask': '255.255.255.0'},
385 ]
386 input_json = {
387 "bond0": {"type": "ethernet.bond"},
388 "bond0.100": {"type": "ethernet.vlan", "parent": "bond0"},
389 "bond0.101": {"type": "ethernet.vlan", "parent": "bond0"},
390 "bond0.102": {"type": "ethernet.vlan", "parent": "bond0"},
391 "bond0.103": {"type": "ethernet.vlan", "parent": "bond0"},
392 "bond1": {"type": "ethernet.bond"},
393 "bond1.200": {"type": "ethernet.vlan", "parent": "bond1"},
394 "bond1.201": {"type": "ethernet.vlan", "parent": "bond1"},
395 "bond1.202": {"type": "ethernet.vlan", "parent": "bond1"},
396 "bond1.203": {"type": "ethernet.vlan", "parent": "bond1"},
397 }
398 form = NodeGroupDefineForm(
399 data={
400 'name': name,
401 'uuid': uuid,
402 'interfaces': json.dumps(interfaces),
403 'ip_addr_json': json.dumps(input_json),
404 })
405 self.assertTrue(form.is_valid(), form._errors)
406 self.assertThat(Fabric.objects.count(), Equals(1))
407 form.save()
408 # After saving the form, there should be two Fabric objects, with
409 # five VLANs each.
410 self.assertThat(Fabric.objects.count(), Equals(2))
411 for fabric in Fabric.objects.all():
412 self.assertThat(fabric.vlan_set.count(), Equals(5))
413
414
351415
352class TestNodeGroupEdit(MAASServerTestCase):416class TestNodeGroupEdit(MAASServerTestCase):
353417