def test_new_address(self): # We don't have a way to ask for new IP address from Serveradmin # and lock it for us. The method below will usually work fine. # When it starts failing, we must develop retry method. new_address = get_next_address(VM_NET, 2) change_address(VM_HOSTNAME, new_address, offline=True) obj = Query({'hostname': VM_HOSTNAME}, ['intern_ip']).get() self.assertEqual(obj['intern_ip'], new_address) with _get_vm(VM_HOSTNAME) as vm: vm.run(cmd('ip a | grep {}', new_address)) self.check_vm_present()
def test_new_address_fail(self): with self.assertRaises(IGVMError): # A wrong IP address won't be reachable change_address(VM_HOSTNAME, '1.2.3.4')