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
1=== modified file 'required-packages/base'
2--- required-packages/base 2016-01-19 22:36:17 +0000
3+++ required-packages/base 2016-01-26 01:18:12 +0000
4@@ -11,6 +11,7 @@
5 libjs-jquery
6 libjs-yui3-min
7 libpq-dev
8+<<<<<<< TREE
9 postgresql-9.4
10 python-bson
11 python-crochet
12@@ -25,6 +26,22 @@
13 python-tempita
14 python-twisted
15 python-yaml
16+=======
17+postgresql
18+python-bson
19+python-crochet
20+python-django
21+python-django-piston
22+python-djorm-ext-pgarray
23+python-formencode
24+python-lxml
25+python-netaddr
26+python-netifaces
27+python-psycopg2
28+python-tempita
29+python-twisted
30+python-yaml
31+>>>>>>> MERGE-SOURCE
32 python3-apt
33 python3-bson
34 python3-convoy
35
36=== modified file 'src/maasserver/tests/test_forms_nodegroup.py'
37--- src/maasserver/tests/test_forms_nodegroup.py 2015-12-01 18:12:59 +0000
38+++ src/maasserver/tests/test_forms_nodegroup.py 2016-01-26 01:18:12 +0000
39@@ -26,7 +26,7 @@
40 from maasserver.models import (
41 NodeGroup,
42 NodeGroupInterface,
43-)
44+ Fabric)
45 from maasserver.testing.factory import factory
46 from maasserver.testing.orm import reload_object
47 from maasserver.testing.testcase import MAASServerTestCase
48@@ -36,7 +36,7 @@
49 HasLength,
50 MatchesStructure,
51 StartsWith,
52-)
53+ Equals)
54
55
56 class TestNodeGroupDefineForm(MAASServerTestCase):
57@@ -348,6 +348,70 @@
58 ipv4_network,
59 interfaces_by_name[network_interface].network)
60
61+ def test_creates_appropriate_fabric_layout(self):
62+ name = factory.make_name('name')
63+ uuid = factory.make_UUID()
64+ interfaces = [
65+ {'interface': 'bond0',
66+ 'ip': '92.140.99.3',
67+ 'subnet_mask': '255.255.255.0'},
68+ {'interface': 'bond0.100',
69+ 'ip': '92.140.100.3',
70+ 'subnet_mask': '255.255.255.0'},
71+ {'interface': 'bond0.101',
72+ 'ip': '92.140.101.3',
73+ 'subnet_mask': '255.255.255.0'},
74+ {'interface': 'bond0.102',
75+ 'ip': '92.140.102.3',
76+ 'subnet_mask': '255.255.255.0'},
77+ {'interface': 'bond0.103',
78+ 'ip': '92.140.103.3',
79+ 'subnet_mask': '255.255.255.0'},
80+ {'interface': 'bond1',
81+ 'ip': '78.146.99.12',
82+ 'subnet_mask': '255.255.255.0'},
83+ {'interface': 'bond1.200',
84+ 'ip': '78.146.200.12',
85+ 'subnet_mask': '255.255.255.0'},
86+ {'interface': 'bond1.201',
87+ 'ip': '78.146.201.12',
88+ 'subnet_mask': '255.255.255.0'},
89+ {'interface': 'bond1.202',
90+ 'ip': '78.146.202.12',
91+ 'subnet_mask': '255.255.255.0'},
92+ {'interface': 'bond1.203',
93+ 'ip': '78.146.203.12',
94+ 'subnet_mask': '255.255.255.0'},
95+ ]
96+ input_json = {
97+ "bond0": {"type": "ethernet.bond"},
98+ "bond0.100": {"type": "ethernet.vlan", "parent": "bond0"},
99+ "bond0.101": {"type": "ethernet.vlan", "parent": "bond0"},
100+ "bond0.102": {"type": "ethernet.vlan", "parent": "bond0"},
101+ "bond0.103": {"type": "ethernet.vlan", "parent": "bond0"},
102+ "bond1": {"type": "ethernet.bond"},
103+ "bond1.200": {"type": "ethernet.vlan", "parent": "bond1"},
104+ "bond1.201": {"type": "ethernet.vlan", "parent": "bond1"},
105+ "bond1.202": {"type": "ethernet.vlan", "parent": "bond1"},
106+ "bond1.203": {"type": "ethernet.vlan", "parent": "bond1"},
107+ }
108+ form = NodeGroupDefineForm(
109+ data={
110+ 'name': name,
111+ 'uuid': uuid,
112+ 'interfaces': json.dumps(interfaces),
113+ 'ip_addr_json': json.dumps(input_json),
114+ })
115+ self.assertTrue(form.is_valid(), form._errors)
116+ self.assertThat(Fabric.objects.count(), Equals(1))
117+ form.save()
118+ # After saving the form, there should be two Fabric objects, with
119+ # five VLANs each.
120+ self.assertThat(Fabric.objects.count(), Equals(2))
121+ for fabric in Fabric.objects.all():
122+ self.assertThat(fabric.vlan_set.count(), Equals(5))
123+
124+
125
126 class TestNodeGroupEdit(MAASServerTestCase):
127