Skip to content

Commit

Permalink
tests: when editing the updates.img generate new one per VM
Browse files Browse the repository at this point in the history
  • Loading branch information
KKoukiou committed Oct 9, 2024
1 parent 0b98b29 commit 6774fe3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ $(UPDATES_IMG): prepare-test-deps
test/prepare-updates-img

create-updates.img: bots
-rm $(UPDATES_IMG)
-rm *updates.img
make $(UPDATES_IMG)

test/reference: test/common
Expand Down
26 changes: 13 additions & 13 deletions test/machine_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _serve_payload(self):

return payload_cached_name, http_payload_port

def _write_interactive_defaults_ks(self, updates_image):
def _write_interactive_defaults_ks(self, updates_image, updates_image_edited):
payload_cached_name, http_payload_port = self._serve_payload()
content = f'liveimg --url="http://10.0.2.2:{http_payload_port}/{payload_cached_name}"'
defaults_path = "usr/share/anaconda/"
Expand All @@ -102,19 +102,23 @@ def _write_interactive_defaults_ks(self, updates_image):
with open(f"{tmp_dir}/{defaults_path}/interactive-defaults.ks", "wt", encoding="utf-8") as f:
f.write(content)
# pack the updates.img again and replace the original one
os.system(f"cd {tmp_dir} && find . | cpio -c -o | gzip -9cv > {updates_image}")
os.system(f"cd {tmp_dir} && find . | cpio -c -o | gzip -9cv > {updates_image_edited}")

def start(self):
update_img_file = os.path.join(ROOT_DIR, "updates.img")
if not os.path.exists(update_img_file):
raise FileNotFoundError("Missing updates.img file")

self.http_updates_img_port = self._serve_updates_img()

self.payload_path = os.path.join(BOTS_DIR, "./images/fedora-rawhide-anaconda-payload")
if not os.path.exists(self.payload_path):
raise FileNotFoundError(f"Missing payload file {self.payload_path}; use 'make payload'.")

update_img_global_file = os.path.join(ROOT_DIR, "updates.img")
update_img_file = os.path.join(ROOT_DIR, self.label + "-updates.img")
if not os.path.exists(update_img_global_file):
raise FileNotFoundError("Missing updates.img file")

if not self.is_live():
# Configure the payload in interactive-defaults.ks
self._write_interactive_defaults_ks(update_img_global_file, update_img_file)

self.http_updates_img_port = self._serve_updates_img()

iso_path = f"{os.getcwd()}/bots/images/{self.image}"
extra_args = ""
Expand All @@ -134,10 +138,6 @@ def start(self):
else:
location = f"{iso_path}"

if not self.is_live():
# Configure the payload in interactive-defaults.ks
self._write_interactive_defaults_ks(update_img_file)

if self.efi:
boot_arg = "--boot uefi "
else:
Expand All @@ -156,7 +156,7 @@ def start(self):
"--noautoconsole "
f"--graphics vnc,listen={self.ssh_address} "
"--extra-args "
f"'inst.sshd inst.webui.remote inst.webui inst.updates=http://10.0.2.2:{self.http_updates_img_port}/updates.img' "
f"'inst.sshd inst.webui.remote inst.webui inst.updates=http://10.0.2.2:{self.http_updates_img_port}/{self.label}-updates.img' "
"--network none "
f"--qemu-commandline="
"'-netdev user,id=hostnet0,"
Expand Down

0 comments on commit 6774fe3

Please sign in to comment.