Skip to content

Commit b936034

Browse files
committed
Merge branch 'testing-hostOS-upgrade' into 'master'
Fix hostOS upgrade test Fix a bug in the host-os-upgrade-test. It's working reliably now, so I removed the "allow-failure" on the job. Note: this test is going to be deleted once we have VM tests on farm, so this is just a band-aid fix. Also, we still need to get the test off of cargo, but we can do that after we merge the fix. See merge request dfinity-lab/public/ic!10450
2 parents 9049f1c + 598d369 commit b936034

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

gitlab-ci/config/54--host-os-test--host-os-upgrade-test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
host-os-upgrade-test:
1313
# This test runs VMs on the CI runner, which can be unreliable and slow. This
1414
# test is soon to be replaced with Farm tests: NODE-565
15-
allow_failure: true
1615
extends:
1716
- .host-e2e-test-base
1817
needs:

ic-os/hostos/tests/ictools.py

+3-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import cbor
1111
import gflags
1212
import requests
13-
import vmtools
1413

1514
FLAGS = gflags.FLAGS
1615

@@ -335,31 +334,13 @@ def wait_ssh_up(host, timeout=FLAGS.timeout):
335334
raise TimeoutError("Time out waiting for IC instance to come up.")
336335

337336

338-
def _get_artifact_version(artifact, kind):
339-
if isinstance(artifact, vmtools.SystemImage):
340-
artifact = artifact.local_path
337+
def get_upgrade_image_version(image):
338+
command_line = f'tar xOzf "{image}" --occurrence=1 ./VERSION.TXT || tar xOzf "{image}" --occurrence=1 ./version.txt'
341339

342-
get_artifact_version = os.path.join(
343-
os.path.dirname(os.path.abspath(__file__)),
344-
"..",
345-
"..",
346-
"guestos",
347-
"tests",
348-
"scripts",
349-
"get-artifact-version.sh",
350-
)
351-
process = subprocess.Popen([get_artifact_version, kind, artifact], stdout=subprocess.PIPE)
340+
process = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE)
352341
return process.stdout.read().decode("utf-8").strip()
353342

354343

355-
def get_disk_image_version(image):
356-
return _get_artifact_version(image, "--disk")
357-
358-
359-
def get_upgrade_image_version(image):
360-
return _get_artifact_version(image, "--upgrade")
361-
362-
363344
def build_ssh_extra_config():
364345
"""
365346
Build extra config containing ssh keys.

ic-os/hostos/tests/vmtools.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,17 @@ def get_name(self):
156156
def stop(self):
157157
"""Stop the virtual machine."""
158158
if self.process:
159-
self.process.terminate()
159+
os.system(f"sudo kill -TERM {self.process.pid}")
160+
160161
try:
161-
self.process.poll(1)
162+
self.process.wait(1)
162163
self.process = None
163164
return
164165
except Exception:
165166
pass
166-
self.process.kill()
167+
168+
os.system(f"sudo kill -KILL {self.process.pid}")
169+
167170
self.process.wait()
168171
self.process = None
169172
return
@@ -198,6 +201,7 @@ def add_netdev(self, netdev, mac):
198201

199202
def _build_base_cmdline(self):
200203
return [
204+
"sudo",
201205
"qemu-system-x86_64",
202206
"-machine",
203207
"type=q35,accel=kvm",

0 commit comments

Comments
 (0)