def test_minio_test_get_request(self): result = self.vm_server.minio_test_get_request() print(result) vm = self.vm_server.sdk.find_by_name( self.vm_server.vm_name__minio_test) vm_process = VM_Process(vm) pprint(vm_process.curl('http://91.109.26.22'))
def setUp(self) -> None: self.sdk = Sdk() self.vm_name = 'dinis-test-via-ovf' self.vm = self.sdk.find_by_name(self.vm_name) if self.vm is None: pytest.skip(f"target server did not have vm {self.vm_name}") else: if self.vm.powered_off(): pytest.skip( f"target server exists but it not Powered On {self.vm_name}" ) self.vm_process = VM_Process(vm=self.vm)
def minio_test_setup_network(self): vm = self.sdk.find_by_name("test-vm-from-ovf") vm_process = VM_Process(vm) #print(vm_process.exec('/bin/ip', 'a')) #print(vm_process.exec('/bin/ip', 'addr add 10.102.66.200/24 dev enp0s25')) #print(vm_process.exec('/bin/cat', '/etc/shadow')) #print(vm_process.exec('/bin/bash', '-c "sudo /bin/cat /etc/shadow"')) print(vm_process.exec('/bin/bash', '-c "sudo ip addr add 78.159.113.32/26 dev eth0"')) # commands from https://ubuntu.com/server/docs/network-configuration print(vm_process.exec('/bin/bash', '-c "sudo ip route add default via 78.159.113.62"')) print(vm_process.exec('/bin/ip', 'a')) print(vm_process.exec('/bin/ip', 'route show'))
class test_VM_Process(TestCase): def setUp(self) -> None: self.sdk = Sdk() self.vm_name = 'dinis-test-via-ovf' self.vm = self.sdk.find_by_name(self.vm_name) if self.vm is None: pytest.skip(f"target server did not have vm {self.vm_name}") else: if self.vm.powered_off(): pytest.skip( f"target server exists but it not Powered On {self.vm_name}" ) self.vm_process = VM_Process(vm=self.vm) def test_start_process_return_stdout(self): program_path = "/bin/ip" arguments = "a" result = self.vm_process.start_process_return_stdout( program_path, arguments) assert 'eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>' in result
def minio_test_setup_network(self): vm = self.sdk.find_by_name(self.vm_name__minio_test) vm_process = VM_Process(vm) #print(vm_process.exec('/bin/ip', 'a')) #print(vm_process.exec('/bin/ip', 'addr add 10.102.66.200/24 dev enp0s25')) #print(vm_process.exec('/bin/cat', '/etc/shadow')) #print(vm_process.exec('/bin/bash', '-c "sudo /bin/cat /etc/shadow"')) print( vm_process.exec('/bin/bash', '-c "sudo ip addr add 91.109.26.22/27 dev eth0"') ) # commands from https://ubuntu.com/server/docs/network-configuration print( vm_process.exec('/bin/bash', '-c "sudo ip route add default via 91.109.26.30"')) print(vm_process.exec('/bin/ip', 'a')) print(vm_process.exec('/bin/ip', 'route show'))
def ubuntu_vm_run_commands(self): vm_name = "test_ubuntu" vm = self.sdk.find_by_name(vm_name) vm_process = VM_Process(vm) vm_process.set_vm_account_from_env("VM_UBUNTU") print(vm_process.vm_account)