~lutostag/ubuntu/trusty/maas/1.5.4+keystone

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_api_pxeconfig.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Andres Rodriguez, Julian Edwards, Dustin Kirkland
  • Date: 2014-03-28 10:43:53 UTC
  • mfrom: (1.2.26)
  • Revision ID: package-import@ubuntu.com-20140328104353-9hj74f1nvl7xis5z
Tags: 1.5+bzr2204-0ubuntu1
* New upstream release (LP: #1281881)

[ Andres Rodriguez ]
* debian/maas-region-controller-min.templates: Set installation note to false
  by default.
* Check rabbitmqctl is present before running commands:
  - debian/maas-region-controller-min.maas-region-celery.upstart.
  - debian/maas-region-controller-min.maas-txlongpoll.upstart.
* make sure maas_longpoll rabbitmq user is created/with correct password on
  a package reconfigure.
* debian/maas-dns.postinst: Fix upgrade setup of named.conf.options.
* debian/maas-cluster-controller.install: Install UEFI templates (LP: #1299143)

[ Julian Edwards ]
* debian/extas/maas: Echo warning to stderr so json stdout is not polluted
* debian/maas-cluster-controller.postinst: Run upgrade-cluster on each
  upgrade
* debian/maas-dns.postinst: Call edit_named_options to add a line in
  /etc/bind/named.conf.options that includes the
  /etc/named/maas/named.conf.options.inside.maas file.
* debian/control:
  - maas-dns depends on python-iscpy
  - maas-cluster-controller depends on python-seamicroclient
* debian/maas-cluster-controller.install: Install bootresources.yaml

[ Dustin Kirkland ]
* debian/control: LP: #1297097
  - clean up package descriptions, modernize, and more clearly/simply
    explain what each package does
  - drop "Ubuntu" in front of MAAS, clean up command line/API description

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    server_address,
25
25
    )
26
26
from maasserver.api import find_nodegroup_for_pxeconfig_request
27
 
from maasserver.enum import (
28
 
    ARCHITECTURE,
29
 
    NODE_STATUS,
30
 
    )
 
27
from maasserver.enum import NODE_STATUS
31
28
from maasserver.models import (
32
29
    Config,
33
30
    MACAddress,
36
33
    compose_enlistment_preseed_url,
37
34
    compose_preseed_url,
38
35
    )
 
36
from maasserver.testing.architecture import make_usable_architecture
39
37
from maasserver.testing.factory import factory
40
38
from maasserver.testing.testcase import MAASServerTestCase
41
39
from maastesting.fakemethod import FakeMethod
107
105
        self.assertEqual(httplib.NO_CONTENT, response.status_code)
108
106
 
109
107
    def test_pxeconfig_returns_success_for_detailed_but_unknown_node(self):
110
 
        architecture = factory.getRandomEnum(ARCHITECTURE)
 
108
        architecture = make_usable_architecture(self)
111
109
        arch, subarch = architecture.split('/')
112
110
        params = dict(
113
111
            self.get_default_params(),
123
121
        # kernel options.
124
122
        value = factory.getRandomString()
125
123
        Config.objects.set_config("kernel_opts", value)
126
 
        architecture = factory.getRandomEnum(ARCHITECTURE)
 
124
        architecture = make_usable_architecture(self)
127
125
        arch, subarch = architecture.split('/')
128
126
        params = dict(
129
127
            self.get_default_params(),
148
146
    def test_pxeconfig_defaults_to_i386_for_default(self):
149
147
        # As a lowest-common-denominator, i386 is chosen when the node is not
150
148
        # yet known to MAAS.
151
 
        expected_arch = tuple(ARCHITECTURE.i386.split('/'))
 
149
        expected_arch = tuple(
 
150
            make_usable_architecture(
 
151
                self, arch_name="i386", subarch_name="generic").split("/"))
152
152
        params_out = self.get_pxeconfig()
153
153
        observed_arch = params_out["arch"], params_out["subarch"]
154
154
        self.assertEqual(expected_arch, observed_arch)
339
339
        params['mac'] = mac.mac_address
340
340
        pxe_config = self.get_pxeconfig(params)
341
341
        self.assertEqual(None, pxe_config['extra_opts'])
 
342
 
 
343
    def test_pxeconfig_sets_nonsense_label_for_insane_state(self):
 
344
        # If pxeconfig() encounters a state where there is no relevant
 
345
        # BootImage for a given set of (nodegroup, arch, subarch,
 
346
        # release, purpose) it sets the label to no-such-image. This is
 
347
        # clearly nonsensical, but this state only arises during tests
 
348
        # or an insane environment.
 
349
        mac = factory.make_mac_address()
 
350
        params = self.get_default_params()
 
351
        params['mac'] = mac.mac_address
 
352
        params['arch'] = 'iHaveNoIdea'
 
353
        pxe_config = self.get_pxeconfig(params)
 
354
        self.assertEqual('no-such-image', pxe_config['label'])