Skip to content

Commit

Permalink
test: Add /container scenario
Browse files Browse the repository at this point in the history
This prepares an image without any cockpit packages, and with an up to
date cockpit/ws container, so that all the code runs via beiboot.

With this we can finally re-introduce at least some tests on RHEL 8,
as that's a very interesting target for beibooting and the ws container
or Cockpit Client.

TODO:
 - hardcoded fedora-40 (FIXME)
  • Loading branch information
martinpitt committed Oct 23, 2024
1 parent b96c408 commit f60f74b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/image-prepare
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,35 @@ def build_install_ostree(dist_tar, image, verbose, quick):
return args


def build_install_container(dist_tar, image, verbose, quick):
"""Build VM with cockpit/ws container
This can test an image with beibooting from a cockpit/ws container, without
any installed cockpit packages.
"""
# FIXME: this needs to be the image that corresponds to the actual cockpit/ws container
# parse from containers/ws/Dockerfile
with create_machine("fedora-40") as m:
build_rpms(dist_tar, m, verbose, quick)
# copy them where ws-container.install expects them
m.execute(r"find /var/tmp/build -name '*.rpm' -not -name '*.src.rpm' -exec mv {} /var/tmp/ \;")
# create container
m.upload([os.path.join(BASE_DIR, "containers")], "/var/tmp/")
with open(os.path.join(TEST_DIR, "ws-container.install")) as f:
m.execute(f.read())
# download container
m.execute("podman save cockpit/ws -o /var/tmp/ws.tar")
m.download("/var/tmp/ws.tar", os.path.abspath("tmp/"))

return [
# install container
"--upload", os.path.abspath("tmp/ws.tar") + ":/var/tmp/",
"--run-command", "podman load -i /var/tmp/ws.tar; rm /var/tmp/ws.tar",
# remove preinstalled rpms
"--run-command", "dnf -C remove -y cockpit-bridge cockpit-ws",
]


def validate_packages():
"""Post-install package checks"""

Expand Down Expand Up @@ -171,6 +200,7 @@ def main():
parser.add_argument('-q', '--quick', action='store_true', help='Skip unit tests to build faster')
parser.add_argument('-o', '--overlay', action='store_true',
help='Install into existing test/image/ overlay instead of from pristine base image')
parser.add_argument('--container', action='store_true', help='Install cockpit/ws container instead of rpms')
parser.add_argument('image', nargs='?', default=DEFAULT_IMAGE, help='The image to use')
args = parser.parse_args()

Expand All @@ -186,6 +216,8 @@ def main():

if args.image == "fedora-coreos":
customize += build_install_ostree(dist_tar, args.image, args.verbose, args.quick)
elif args.container:
customize += build_install_container(dist_tar, args.image, args.verbose, args.quick)
else:
customize += build_install_package(dist_tar, args.image)

Expand Down
4 changes: 4 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ case "${TEST_SCENARIO:=}" in
*other*)
RUN_OPTS="$RUN_OPTS $(echo "$ALL_TESTS" | grep -Ev "$RE_NETWORKING|$RE_STORAGE|$RE_EXPENSIVE")"
;;&
*ws-container*)
PREPARE_OPTS="$PREPARE_OPTS --quick --ws-container"
RUN_OPTS="$RUN_OPTS "
;;&

esac

Expand Down

0 comments on commit f60f74b

Please sign in to comment.