Merge lp:~blake-rouse/maas/test-os-preseed-templates into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 2522
Proposed branch: lp:~blake-rouse/maas/test-os-preseed-templates
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 69 lines (+53/-0)
1 file modified
src/maasserver/tests/test_preseed.py (+53/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/test-os-preseed-templates
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+225838@code.launchpad.net

Commit message

Add tests for curtin_userdata_{centos,suse,windows}. Add tests for preseed_master_windows_amd64_generic_{win2012,win2012hv,win2012hvr2,win2012r2}.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

This is cool. Thanks for taking this on so quickly!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/tests/test_preseed.py'
2--- src/maasserver/tests/test_preseed.py 2014-07-02 07:05:24 +0000
3+++ src/maasserver/tests/test_preseed.py 2014-07-07 14:29:25 +0000
4@@ -591,6 +591,33 @@
5 preseed, MatchesAll(*[Contains(ng_url), Not(Contains(maas_url))]))
6
7
8+class TestRenderPreseedWindows(MAASServerTestCase):
9+ """Tests for `render_preseed`.
10+
11+ These tests check that the templates render (i.e. that no variable is
12+ missing).
13+ """
14+
15+ # Create a scenario for each possible windows release.
16+ scenarios = [
17+ (release, {'release': release})
18+ for release in ['win2012', 'win2012hv', 'win2012hvr2', 'win2012r2']
19+ ]
20+
21+ def test_render_preseed(self):
22+ node = factory.make_node(
23+ osystem='windows', architecture='amd64/generic',
24+ distro_series=self.release)
25+ factory.make_boot_image(
26+ osystem='windows', architecture='amd64', subarchitecture='generic',
27+ release=self.release, purpose='install', nodegroup=node.nodegroup)
28+ preseed = render_preseed(
29+ node, '', osystem='windows', release=self.release)
30+ # The test really is that the preseed is rendered without an
31+ # error.
32+ self.assertIsInstance(preseed, bytes)
33+
34+
35 class TestGetCurtinUserData(MAASServerTestCase):
36 """Tests for `get_curtin_userdata`."""
37
38@@ -611,6 +638,32 @@
39 self.assertIn("PREFIX='curtin'", user_data)
40
41
42+class TestGetCurtinUserDataOS(MAASServerTestCase):
43+ """Tests for `get_curtin_userdata` using os specific scenarios."""
44+
45+ # Create a scenario for each possible os specific preseed.
46+ scenarios = [
47+ (name, {'os_name': name})
48+ for name in ['centos', 'suse', 'windows']
49+ ]
50+
51+ def test_get_curtin_userdata(self):
52+ node = factory.make_node(osystem=self.os_name)
53+ factory.make_node_group_interface(
54+ node.nodegroup, management=NODEGROUPINTERFACE_MANAGEMENT.DHCP)
55+ arch, subarch = node.architecture.split('/')
56+ factory.make_boot_image(
57+ osystem=node.get_osystem(),
58+ architecture=arch, subarchitecture=subarch,
59+ release=node.get_distro_series(), purpose='xinstall',
60+ xinstall_path='root-tgz', xinstall_type='tgz',
61+ nodegroup=node.nodegroup)
62+ node.use_fastpath_installer()
63+ user_data = get_curtin_userdata(node)
64+ # Just check that the user data looks good.
65+ self.assertIn("PREFIX='curtin'", user_data)
66+
67+
68 class TestCurtinUtilities(MAASServerTestCase):
69 """Tests for the curtin-related utilities."""
70