Exemplo n.º 1
0
 def test_find_existing_keeps_type(self):
     node_type = random.choice(
         (NODE_TYPE.RACK_CONTROLLER, NODE_TYPE.REGION_AND_RACK_CONTROLLER))
     node = factory.make_Node(node_type=node_type)
     register(system_id=node.system_id)
     self.assertEqual(node_type, node.node_type)
Exemplo n.º 2
0
 def test_finds_existing_node_by_system_id(self):
     node = factory.make_Node()
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(node.system_id, rack_registered.system_id)
Exemplo n.º 3
0
 def test_finds_existing_node_by_hostname(self):
     node = factory.make_Node()
     rack_registered = register(hostname=node.hostname)
     self.assertEqual(node.system_id, rack_registered.system_id)
Exemplo n.º 4
0
 def test_sets_owner_to_worker_when_none(self):
     node = factory.make_Node()
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(worker_user.get_worker_user(), rack_registered.owner)
Exemplo n.º 5
0
 def test_leaves_owner_when_owned(self):
     user = factory.make_User()
     node = factory.make_Machine(owner=user)
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(user, rack_registered.owner)
Exemplo n.º 6
0
 def test_always_has_current_commissioning_script_set(self):
     hostname = factory.make_name('hostname')
     register(hostname=hostname)
     rack = RackController.objects.get(hostname=hostname)
     self.assertIsNotNone(rack.current_commissioning_script_set)
Exemplo n.º 7
0
 def test_converts_existing_node(self):
     node = factory.make_Node(node_type=NODE_TYPE.MACHINE)
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(rack_registered.node_type, NODE_TYPE.RACK_CONTROLLER)
Exemplo n.º 8
0
 def test_converts_region_controller(self):
     node = factory.make_Node(node_type=NODE_TYPE.REGION_CONTROLLER)
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(rack_registered.node_type,
                      NODE_TYPE.REGION_AND_RACK_CONTROLLER)
Exemplo n.º 9
0
 def test_sets_version_of_controller(self):
     version = "1.10.2"
     node = factory.make_Node(node_type=NODE_TYPE.MACHINE)
     register(system_id=node.system_id, version=version)
     self.assertEquals(version, node.as_rack_controller().version)
Exemplo n.º 10
0
 def test_converts_existing_node(self):
     node = factory.make_Machine()
     rack_registered = register(system_id=node.system_id)
     self.assertEqual(rack_registered.node_type, NODE_TYPE.RACK_CONTROLLER)
     reload_object(node)
     self.assertTrue(node.as_rack_controller()._was_probably_machine())