From 1b0319ae8309df90970cf57e230e3430660d3d28 Mon Sep 17 00:00:00 2001 From: "Jason N." <33561705+JasonN3@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:58:24 -0500 Subject: [PATCH] add flatpak test --- .github/workflows/build-and-test.yml | 18 ++++++++++-------- Makefile | 9 +++++++-- README.md | 23 +++++++++++++---------- tests/vm/flatpaks.yml | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 tests/vm/flatpaks.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 897ea8c..4acea6c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -208,12 +208,14 @@ jobs: fi echo "VM ready for tests at IP ${VM_IP}" - for check in $(ls tests/vm) - do - if [[ -f $check && $check != "README.md" ]] - then - chmod +x $check - ./${check} - fi - done + echo "Creating Ansible inventory" + cat << EOF > ansible_inventory + hosts: + vm: + ansible_host: ${VM_IP} + ansible_user: ${VM_USER} + ansible_password: ${VM_PASS} + EOF + + make test-vm diff --git a/Makefile b/Makefile index 7489823..fe9b842 100644 --- a/Makefile +++ b/Makefile @@ -187,11 +187,16 @@ clean: install-deps: dnf install -y lorax xorriso skopeo flatpak dbus-daemon ostree -test: test-iso +test: test-iso test-vm test-iso: $(eval _TESTS = $(filter-out README.md,$(shell ls tests/iso))) $(foreach test,$(_TESTS),chmod +x tests/iso/$(test)) $(foreach test,$(_TESTS),./tests/iso/$(test) deploy.iso) + +test-vm: + $(eval _TESTS = $(filter-out README.md,$(shell ls tests/vm))) + $(foreach test,$(_TESTS),chmod +x tests/vm/$(test)) + $(foreach test,$(_TESTS),./tests/vm/$(test) deploy.iso) -.PHONY: clean install-deps test test-iso +.PHONY: clean install-deps test test-iso test-vm diff --git a/README.md b/README.md index 82217f9..fbe383b 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,19 @@ See [Customizing](#customizing) for information about customizing the ISO that g ## Customizing The following variables can be used to customize the created ISO. -| Variable | Description | Default Value | -| ----------------- | -------------------------------------------------------- | ------------------------------ | -| ARCH | Architecture for image to build | x86_64 | -| VERSION | Fedora version of installer to build | 39 | -| IMAGE_REPO | Repository containing the source container image | quay.io/fedora-ostree-desktops | -| IMAGE_NAME | Name of the source container image | base | -| IMAGE_TAG | Tag of the source container image | *VERSION* | -| EXTRA_BOOT_PARAMS | Extra params used by grub to boot the anaconda installer | \[empty\] | -| VARIANT | Source container variant\* | Server | -| WEB_UI | Enable Anaconda WebUI (experimental) | false | +| Variable | Description | Default Value | +| ------------------- | -------------------------------------------------------- | -------------------------------------------- | +| ARCH | Architecture for image to build | x86_64 | +| VERSION | Fedora version of installer to build | 39 | +| IMAGE_REPO | Repository containing the source container image | quay.io/fedora-ostree-desktops | +| IMAGE_NAME | Name of the source container image | base | +| IMAGE_TAG | Tag of the source container image | *VERSION* | +| EXTRA_BOOT_PARAMS | Extra params used by grub to boot the anaconda installer | \[empty\] | +| VARIANT | Source container variant\* | Server | +| WEB_UI | Enable Anaconda WebUI (experimental) | false | +| FLATPAK_REMOTE_NAME | Name of the Flatpak repo | flathub | +| FLATPAK_REMOTE_URL | URL to the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | +| FLATPAK_REMOTE_REFS | Space delimited list of Flatpak package refs to install | \[empty\] | Available options for VARIANT can be found by running `dnf provides system-release`. Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinoite diff --git a/tests/vm/flatpaks.yml b/tests/vm/flatpaks.yml new file mode 100644 index 0000000..fcaa732 --- /dev/null +++ b/tests/vm/flatpaks.yml @@ -0,0 +1,22 @@ +#!/usr/bin/env ansible-playbook -i ansible_inventory +--- +- name: Test for flatpaks + hosts: vm + gather_facts: no + + tasks: + - name: Get gpg key + ansible.builtin.set-fact: + found_gpg: "{{ slurpfile['/ostree/deploy/default/var/lib/flatpak/repo'] | base64 }}" + expected_gpg: "{{ lookup('ansible.builtin.url', 'https://flathub.org/repo/flathub.flatpakrepo', split_lines=True) | regex_search('^GPGKey=(.*)$', '\\1' multiline=True, ignorecase=True) }}" + + - name: Test GPG key + ansible.builtin.assert: + that: + - found_gpg == found_gpg + fail_msg: "Installed GPG key does not match GPG key in flatpakrepo file" + success_msg: "GPG key matches" + + - name: Test updating flatpak packages + ansible.builtin.command: + cmd: /usr/bin/flatpak update -y