mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
add test for flatpaks installed
This commit is contained in:
parent
3dc05c0efc
commit
9277acf58a
3 changed files with 65 additions and 13 deletions
11
.github/workflows/build-and-test.yml
vendored
11
.github/workflows/build-and-test.yml
vendored
|
|
@ -263,5 +263,14 @@ jobs:
|
||||||
|
|
||||||
echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}"
|
echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}"
|
||||||
|
|
||||||
make test-vm VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS}
|
make test-vm VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS} \
|
||||||
|
ARCH=${{ env.ARCH}} \
|
||||||
|
IMAGE_NAME=${{ env.IMAGE_NAME}} \
|
||||||
|
IMAGE_REPO=${{ env.IMAGE_REPO}} \
|
||||||
|
IMAGE_TAG=${{ matrix.version }} \
|
||||||
|
VERSION=${{ matrix.version }} \
|
||||||
|
VARIANT=${{ env.VARIANT }} \
|
||||||
|
FLATPAK_REMOTE_REFS_DIR=${{ env.FLATPAK_REMOTE_REFS_DIR }} \
|
||||||
|
SECURE_BOOT_KEY_URL=${{ env.SECURE_BOOT_KEY_URL }} \
|
||||||
|
ENROLLMENT_PASSWORD=${{ env.ENROLLMENT_PASSWORD }}
|
||||||
kill $QEMU_PID
|
kill $QEMU_PID
|
||||||
|
|
|
||||||
38
Makefile
38
Makefile
|
|
@ -32,6 +32,11 @@ PACKAGE_MANAGER = dnf
|
||||||
get_templates = $(shell ls lorax_templates/$(1)_*.tmpl) \
|
get_templates = $(shell ls lorax_templates/$(1)_*.tmpl) \
|
||||||
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
|
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
|
||||||
|
|
||||||
|
# Get a list of tests for the feature
|
||||||
|
# $1 = test type
|
||||||
|
# $2 = feature
|
||||||
|
get_tests = $(shell ls tests/$(1)/$(2)_*)
|
||||||
|
|
||||||
# Converts a post script to a template
|
# Converts a post script to a template
|
||||||
# $1 = script to convert
|
# $1 = script to convert
|
||||||
# $2 = file on ISO to write
|
# $2 = file on ISO to write
|
||||||
|
|
@ -218,7 +223,6 @@ install-test-deps:
|
||||||
test: test-iso test-vm
|
test: test-iso test-vm
|
||||||
|
|
||||||
test-iso:
|
test-iso:
|
||||||
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/iso)))
|
|
||||||
$(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
|
$(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
|
||||||
|
|
||||||
sudo modprobe loop
|
sudo modprobe loop
|
||||||
|
|
@ -227,19 +231,19 @@ test-iso:
|
||||||
sudo mount -t squashfs -o loop /mnt/iso/images/install.img /mnt/install
|
sudo mount -t squashfs -o loop /mnt/iso/images/install.img /mnt/install
|
||||||
|
|
||||||
# install tests
|
# install tests
|
||||||
chmod +x $(foreach test,$(filter install_%,$(_TESTS)),tests/iso/$(test))
|
chmod +x $(call get_tests,iso,install)
|
||||||
for test in $(_TESTS); \
|
for test in $(call get_tests,iso,install); \
|
||||||
do \
|
do \
|
||||||
$(foreach var,$(_VARS),$(var)=$($(var))) ./tests/iso/$${test}; \
|
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
|
||||||
done
|
done
|
||||||
|
|
||||||
# flapak tests
|
# flapak tests
|
||||||
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; \
|
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; \
|
||||||
then \
|
then \
|
||||||
chmod +x $(foreach test,$(filter flatpak_%,$(_TESTS)),tests/iso/$(test)); \
|
chmod +x $(call get_tests,iso,flatpak); \
|
||||||
for test in $(_TESTS); \
|
for test in $(call get_tests,iso,flatpak); \
|
||||||
do \
|
do \
|
||||||
$(foreach var,$(_VARS),$(var)=$($(var))) ./tests/iso/$${test}; \
|
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
|
||||||
done; \
|
done; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -260,8 +264,22 @@ ansible_inventory:
|
||||||
|
|
||||||
test-vm: ansible_inventory
|
test-vm: ansible_inventory
|
||||||
ansible -i ansible_inventory -m ansible.builtin.wait_for_connection vm
|
ansible -i ansible_inventory -m ansible.builtin.wait_for_connection vm
|
||||||
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/vm)))
|
|
||||||
chmod +x $(foreach test,$(_TESTS),tests/vm/$(test))
|
# install tests
|
||||||
for test in $(_TESTS); do ./tests/vm/$${test}; done
|
chmod +x $(call get_tests,vm,install)
|
||||||
|
for test in $(call get_tests,vm,install); \
|
||||||
|
do \
|
||||||
|
./$${test}; \
|
||||||
|
done
|
||||||
|
|
||||||
|
# flapak tests
|
||||||
|
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; \
|
||||||
|
then \
|
||||||
|
chmod +x $(call get_tests,iso,flatpak); \
|
||||||
|
for test in $(call get_tests,iso,flatpak); \
|
||||||
|
do \
|
||||||
|
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: clean install-deps install-test-deps test test-iso test-vm
|
.PHONY: clean install-deps install-test-deps test test-iso test-vm
|
||||||
|
|
|
||||||
25
tests/vm/flatpak_installed.yml
Normal file
25
tests/vm/flatpak_installed.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env -S ansible-playbook -i ./ansible_inventory
|
||||||
|
---
|
||||||
|
- name: Test for installed flatpaks
|
||||||
|
hosts: vm
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
# Verifies that the flatpaks are installed
|
||||||
|
- name: Get list of installed Flatpaks
|
||||||
|
become: true
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: /usr/bin/flatpak list
|
||||||
|
register: flatpaks
|
||||||
|
|
||||||
|
- name: Check that VLC is installed
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- "'VLC' in flatpaks.stdout"
|
||||||
|
fail_msg: 'VLC is not installed'
|
||||||
|
|
||||||
|
- name: Check that VLC is installed
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- "'Firefox' in flatpaks.stdout"
|
||||||
|
fail_msg: 'Firefox is not installed'
|
||||||
Loading…
Add table
Add a link
Reference in a new issue