~rvb/maas/transaction-1.7-bug-1409852

« back to all changes in this revision

Viewing changes to src/maasserver/clusterrpc/tests/test_osystems.py

merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
    def test_yields_oses_known_to_a_cluster(self):
48
48
        # The operating systems known to a single node are returned.
49
 
        factory.make_node_group().accept()
 
49
        factory.make_NodeGroup().accept()
50
50
        self.useFixture(RunningClusterRPCFixture())
51
51
        osystems = gen_all_known_operating_systems()
52
52
        self.assertIsInstance(osystems, Iterator)
55
55
        self.assertThat(osystems, AllMatch(IsInstance(dict)))
56
56
 
57
57
    def test_yields_oses_known_to_multiple_clusters(self):
58
 
        factory.make_node_group().accept()
59
 
        factory.make_node_group().accept()
 
58
        factory.make_NodeGroup().accept()
 
59
        factory.make_NodeGroup().accept()
60
60
        self.useFixture(RunningClusterRPCFixture())
61
61
        osystems = gen_all_known_operating_systems()
62
62
        self.assertIsInstance(osystems, Iterator)
67
67
    def test_only_yields_os_once(self):
68
68
        # Duplicate OSes that exactly match are suppressed. Typically
69
69
        # every cluster will have several (or all) OSes in common.
70
 
        factory.make_node_group().accept()
71
 
        factory.make_node_group().accept()
 
70
        factory.make_NodeGroup().accept()
 
71
        factory.make_NodeGroup().accept()
72
72
        self.useFixture(RunningClusterRPCFixture())
73
73
        counter = Counter(
74
74
            osystem["name"] for osystem in
83
83
                AfterPreprocessing(get_count, Equals(1))))
84
84
 
85
85
    def test_os_data_is_passed_through_unmolested(self):
86
 
        factory.make_node_group().accept()
 
86
        factory.make_NodeGroup().accept()
87
87
        self.useFixture(RunningClusterRPCFixture())
88
88
        example = {
89
89
            "osystems": [
102
102
            example["osystems"], gen_all_known_operating_systems())
103
103
 
104
104
    def test_ignores_failures_when_talking_to_clusters(self):
105
 
        factory.make_node_group().accept()
106
 
        factory.make_node_group().accept()
107
 
        factory.make_node_group().accept()
 
105
        factory.make_NodeGroup().accept()
 
106
        factory.make_NodeGroup().accept()
 
107
        factory.make_NodeGroup().accept()
108
108
        self.useFixture(RunningClusterRPCFixture())
109
109
 
110
110
        clients = getAllClients()
132
132
 
133
133
    def test_returns_preseed_data(self):
134
134
        # The Windows driver is known to provide custom preseed data.
135
 
        node = factory.make_node(osystem="windows")
 
135
        node = factory.make_Node(osystem="windows")
136
136
        node.nodegroup.accept()
137
137
        self.useFixture(RunningClusterRPCFixture())
138
138
        preseed_data = get_preseed_data(
146
146
    def test_propagates_NotImplementedError(self):
147
147
        # The Windows driver is known to *not* provide custom preseed
148
148
        # data when using Curtin.
149
 
        node = factory.make_node(osystem="windows")
 
149
        node = factory.make_Node(osystem="windows")
150
150
        node.nodegroup.accept()
151
151
        self.useFixture(RunningClusterRPCFixture())
152
152
        self.assertRaises(
155
155
            metadata_url=factory.make_url())
156
156
 
157
157
    def test_propagates_NoSuchOperatingSystem(self):
158
 
        node = factory.make_node(osystem=factory.make_name("foo"))
 
158
        node = factory.make_Node(osystem=factory.make_name("foo"))
159
159
        node.nodegroup.accept()
160
160
        self.useFixture(RunningClusterRPCFixture())
161
161
        self.assertRaises(