build: justfile: simplify test orchestration.

This commit is contained in:
Alexandre Pujol 2025-07-22 23:31:14 +02:00 committed by Alex
parent 7d2229cd05
commit 94bae18c2c
4 changed files with 87 additions and 53 deletions

View file

@ -284,6 +284,18 @@ destroy dist flavor:
ssh dist flavor: ssh dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` @ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}`
[group('vm')]
[doc('Mount the shared directory on the machine')]
mount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \
sh -c 'mount | grep 0a31bc478ef8e2461a4b1cc10a24cc4 || sudo mount 0a31bc478ef8e2461a4b1cc10a24cc4'
[group('vm')]
[doc('Unmout the shared directory on the machine')]
umount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \
sh -c 'true; sudo umount /home/{{username}}/Projects/apparmor.d || true'
[group('vm')] [group('vm')]
[doc('List the machines')] [doc('List the machines')]
list: list:
@ -324,7 +336,6 @@ available:
} }
' '
[group('tests')] [group('tests')]
[doc('Install dependencies for the integration tests')] [doc('Install dependencies for the integration tests')]
init: init:
@ -349,30 +360,18 @@ tests-sync dist flavor:
[group('tests')] [group('tests')]
[doc('Re-synchronize the integration tests (machine)')] [doc('Re-synchronize the integration tests (machine)')]
tests-resync dist flavor: (tests-mount dist flavor) \ tests-resync dist flavor: (mount dist flavor) \
(tests-sync dist flavor) \ (tests-sync dist flavor) \
(tests-umount dist flavor) (umount dist flavor)
[group('tests')]
[doc('Unmout the integration tests (machine)')]
tests-umount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \
sudo umount /home/{{username}}/Projects/apparmor.d
[group('tests')] [group('tests')]
[doc('Run the integration tests (machine)')] [doc('Run the integration tests (machine)')]
tests-run dist flavor name="": tests-run dist flavor name="": (tests-resync dist flavor)
ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \
TERM=xterm \ TERM=xterm \
bats --recursive --pretty --timing --print-output-on-failure \ bats --recursive --pretty --timing --print-output-on-failure \
/home/{{username}}/Projects/tests/integration/{{name}} /home/{{username}}/Projects/tests/integration/{{name}}
[group('tests')]
[doc('Mount integration tests (machine)')]
tests-mount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \
sudo mount 0a31bc478ef8e2461a4b1cc10a24cc4
[private] [private]
get_ip dist flavor: get_ip dist flavor:
@virsh --quiet --readonly {{c}} domifaddr {{prefix}}{{dist}}-{{flavor}} | \ @virsh --quiet --readonly {{c}} domifaddr {{prefix}}{{dist}}-{{flavor}} | \

View file

@ -14,15 +14,43 @@ Although the integration test suite is intended to be run in a [Development VM](
## Getting started ## Getting started
Prepare the test environment: **Prepare the test environment:**
```sh ```sh
just img <dist> <flavor> just img <dist> <flavor>
just vm <dist> <flavor> just create <dist> <flavor>
``` ```
Run the integration tests on the test VM: Example:
```sh ```sh
just integration <dist> <flavor> just img ubuntu25 desktop
just create ubuntu25 desktop
```
**Install dependencies for the integration tests**
```sh
just tests-init <dist> <flavor>
```
Example:
```sh
just tests-init ubuntu25 desktop
```
**Run the integration tests**
It: synchronizes the tests, unmount the shared directory, then run the tests.
```sh
just tests-run <dist> <flavor>
```
Example:
```sh
just tests-run ubuntu25 desktop
```
Partial tests can also be run. For example the following command will only run the tests in the `tests/integration/apt` directory on the `ubuntu25` `desktop` machine:
```sh
just tests-run ubuntu25 desktop apt
``` ```
## Create integration tests ## Create integration tests

View file

@ -37,8 +37,12 @@ Available recipes:
[tests] [tests]
tests # Run the unit tests tests # Run the unit tests
init dist flavor # Install dependencies for the bats integration tests init # Install dependencies for the integration tests
integration dist flavor # Run the integration tests on the machine integration # Run the integration tests
tests-init dist flavor # Install dependencies for the integration tests (machine)
tests-sync dist flavor # Synchronize the integration tests (machine)
tests-resync dist flavor # Re-synchronize the integration tests (machine)
tests-run dist flavor name="" # Run the integration tests (machine)
[linter] [linter]
lint # Run the linters lint # Run the linters
@ -57,6 +61,8 @@ Available recipes:
reboot dist flavor # Reboot the machine reboot dist flavor # Reboot the machine
destroy dist flavor # Destroy the machine destroy dist flavor # Destroy the machine
ssh dist flavor # Connect to the machine ssh dist flavor # Connect to the machine
mount dist flavor # Mount the shared directory on the machine
umount dist flavor # Unmout the shared directory on the machine
list # List the machines list # List the machines
images # List the VM images images # List the VM images
available # List the VM images that can be created available # List the VM images that can be created

View file

@ -37,6 +37,7 @@ The following desktop environments are supported:
**Build dependency** **Build dependency**
* Go >= 1.23 * Go >= 1.23
* [just](https://github.com/casey/just)
## Configure AppArmor ## Configure AppArmor