build: justfile: simplify test orchestration.
This commit is contained in:
parent
dd5284532f
commit
b30abed34f
4 changed files with 87 additions and 53 deletions
31
Justfile
31
Justfile
|
|
@ -284,6 +284,18 @@ destroy dist flavor:
|
|||
ssh 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')]
|
||||
[doc('List the machines')]
|
||||
list:
|
||||
|
|
@ -324,7 +336,6 @@ available:
|
|||
}
|
||||
'
|
||||
|
||||
|
||||
[group('tests')]
|
||||
[doc('Install dependencies for the integration tests')]
|
||||
init:
|
||||
|
|
@ -349,30 +360,18 @@ tests-sync dist flavor:
|
|||
|
||||
[group('tests')]
|
||||
[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-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
|
||||
(umount dist flavor)
|
||||
|
||||
[group('tests')]
|
||||
[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}}` \
|
||||
TERM=xterm \
|
||||
bats --recursive --pretty --timing --print-output-on-failure \
|
||||
/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]
|
||||
get_ip dist flavor:
|
||||
@virsh --quiet --readonly {{c}} domifaddr {{prefix}}{{dist}}-{{flavor}} | \
|
||||
|
|
|
|||
|
|
@ -14,15 +14,43 @@ Although the integration test suite is intended to be run in a [Development VM](
|
|||
|
||||
## Getting started
|
||||
|
||||
Prepare the test environment:
|
||||
**Prepare the test environment:**
|
||||
```sh
|
||||
just img <dist> <flavor>
|
||||
just vm <dist> <flavor>
|
||||
just create <dist> <flavor>
|
||||
```
|
||||
|
||||
Run the integration tests on the test VM:
|
||||
Example:
|
||||
```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
|
||||
|
|
|
|||
|
|
@ -13,53 +13,59 @@ $ just
|
|||
|
||||
```
|
||||
Available recipes:
|
||||
help # Show this help message
|
||||
clean # Remove all build artifacts
|
||||
help # Show this help message
|
||||
clean # Remove all build artifacts
|
||||
|
||||
[build]
|
||||
build # Build the go programs
|
||||
enforce # Prebuild the profiles in enforced mode
|
||||
complain # Prebuild the profiles in complain mode
|
||||
fsp # Prebuild the profiles in FSP mode
|
||||
fsp-complain # Prebuild the profiles in FSP mode (complain)
|
||||
fsp-debug # Prebuild the profiles in FSP mode (debug)
|
||||
build # Build the go programs
|
||||
enforce # Prebuild the profiles in enforced mode
|
||||
complain # Prebuild the profiles in complain mode
|
||||
fsp # Prebuild the profiles in FSP mode
|
||||
fsp-complain # Prebuild the profiles in FSP mode (complain)
|
||||
fsp-debug # Prebuild the profiles in FSP mode (debug)
|
||||
|
||||
[install]
|
||||
install # Install prebuild profiles
|
||||
local +names # Locally install prebuild profiles
|
||||
dev name # Prebuild, install, and load a dev profile
|
||||
install # Install prebuild profiles
|
||||
local +names # Locally install prebuild profiles
|
||||
dev name # Prebuild, install, and load a dev profile
|
||||
|
||||
[packages]
|
||||
pkg # Build & install apparmor.d on Arch based systems
|
||||
dpkg # Build & install apparmor.d on Debian based systems
|
||||
rpm # Build & install apparmor.d on OpenSUSE based systems
|
||||
package dist # Build the package in a clean OCI container
|
||||
pkg # Build & install apparmor.d on Arch based systems
|
||||
dpkg # Build & install apparmor.d on Debian based systems
|
||||
rpm # Build & install apparmor.d on OpenSUSE based systems
|
||||
package dist # Build the package in a clean OCI container
|
||||
|
||||
[tests]
|
||||
tests # Run the unit tests
|
||||
init dist flavor # Install dependencies for the bats integration tests
|
||||
integration dist flavor # Run the integration tests on the machine
|
||||
tests # Run the unit tests
|
||||
init # Install dependencies for the integration tests
|
||||
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]
|
||||
lint # Run the linters
|
||||
check # Run style checks on the profiles
|
||||
lint # Run the linters
|
||||
check # Run style checks on the profiles
|
||||
|
||||
[docs]
|
||||
man # Generate the man pages
|
||||
docs # Build the documentation
|
||||
serve # Serve the documentation
|
||||
man # Generate the man pages
|
||||
docs # Build the documentation
|
||||
serve # Serve the documentation
|
||||
|
||||
[vm]
|
||||
img dist flavor # Build the VM image
|
||||
create dist flavor # Create the machine
|
||||
up dist flavor # Start a machine
|
||||
halt dist flavor # Stops the machine
|
||||
reboot dist flavor # Reboot the machine
|
||||
destroy dist flavor # Destroy the machine
|
||||
ssh dist flavor # Connect to the machine
|
||||
list # List the machines
|
||||
images # List the VM images
|
||||
available # List the VM images that can be created
|
||||
img dist flavor # Build the VM image
|
||||
create dist flavor # Create the machine
|
||||
up dist flavor # Start a machine
|
||||
halt dist flavor # Stops the machine
|
||||
reboot dist flavor # Reboot the machine
|
||||
destroy dist flavor # Destroy 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
|
||||
images # List the VM images
|
||||
available # List the VM images that can be created
|
||||
|
||||
See https://apparmor.pujol.io/development/ for more information.
|
||||
```
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ The following desktop environments are supported:
|
|||
**Build dependency**
|
||||
|
||||
* Go >= 1.23
|
||||
* [just](https://github.com/casey/just)
|
||||
|
||||
|
||||
## Configure AppArmor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue