def setUp(self): self.network = testvm.VirtNetwork(0) self.machine = testvm.VirtMachine(self.image, networking=self.network.host(), memory_mb=2048) print("Starting virtual machine '{}'".format(self.image)) self.machine.start() self.machine.wait_boot() # run a command to force starting the SSH master self.machine.execute("uptime") self.ssh_command = [ "ssh", "-o", "ControlPath=" + self.machine.ssh_master, "-p", self.machine.ssh_port, self.machine.ssh_user + "@" + self.machine.ssh_address ] print("Machine is up. Connect to it via:") print(" ".join(self.ssh_command)) print() print("Waiting for lorax-composer to become ready...") curl_command = [ "curl", "--max-time", "360", "--silent", "--unix-socket", "/run/weldr/api.socket", "http://localhost/api/status" ] r = subprocess.run(self.ssh_command + curl_command, stdout=subprocess.DEVNULL) self.assertEqual(r.returncode, 0)
def setUpTestMachine(self, image=testvm.DEFAULT_IMAGE, identity_file=None): self.network = testvm.VirtNetwork(0) # default overlay directory is not big enough to hold the large composed trees; thus put overlay into /var/tmp/ self.machine = testvm.VirtMachine(image, networking=self.network.host(), cpus=2, memory_mb=2048, overlay_dir="/var/tmp", identity_file=identity_file) print("Starting virtual machine '{}'".format(image)) self.machine.start() # Modified wait_boot that doesn't check for /run/nologin self.wait_boot() # run a command to force starting the SSH master self.machine.execute("uptime") self.ssh_command = [ "ssh", "-o", "ControlPath=" + self.machine.ssh_master, "-p", self.machine.ssh_port, self.machine.ssh_user + "@" + self.machine.ssh_address ] print("Machine is up. Connect to it via:") print(" ".join(self.ssh_command)) print()
def setUpTestMachine(self, image=testvm.DEFAULT_IMAGE, identity_file=None): self.network = testvm.VirtNetwork(0) if identity_file: self.machine = testvm.VirtMachine(image, networking=self.network.host(), cpus=2, memory_mb=2048, identity_file=identity_file) else: self.machine = testvm.VirtMachine(image, networking=self.network.host(), cpus=2, memory_mb=2048) print("Starting virtual machine '{}'".format(image)) self.machine.start() # Modified wait_boot that doesn't check for /run/nologin self.wait_boot() # run a command to force starting the SSH master self.machine.execute("uptime") self.ssh_command = ["ssh", "-o", "ControlPath=" + self.machine.ssh_master, "-p", self.machine.ssh_port, self.machine.ssh_user + "@" + self.machine.ssh_address] print("Machine is up. Connect to it via:") print(" ".join(self.ssh_command)) print()