Compare commits

...
Author SHA1 Message Date
devydave a2647c3331 refactor: add option to run specific test files, file mode ssh key and ignore changes to path_to_file
continuous-integration/drone/push Build is passing
2026-08-31 10:59:02 +02:00
devydave d510e13461 docs: explains -t option
continuous-integration/drone/push Build is passing
2026-08-24 23:31:12 +02:00
devydave 470a34fdb1 test: adds automation script and ignore path_to_repo changes 2026-08-24 23:29:30 +02:00
4 changed files with 52 additions and 3 deletions
+1
View File
@@ -7,3 +7,4 @@
/bin
dist/
tests/integration/.bats
tests/resources/path_to_repo
+10 -2
View File
@@ -123,6 +123,14 @@ vm-server-connect:
test-integration-hosts:
./scripts/tests/extra_hosts
test-integration:
# TEST_INTEGRATION_FILES overrides the default of running all test files
ifdef TEST_INTEGRATION_FILES
test_files := $(TEST_INTEGRATION_FILES);
else
test_files := *;
endif
test-integration: build
chmod 600 ./tests/resources/local_integration_ssh
ssh-add ./tests/resources/local_integration_ssh
@bats -Tp tests/integration --verbose-run
@bats -Tp --verbose-run tests/integration/$(test_files)
+4 -1
View File
@@ -43,7 +43,10 @@ All commands are run on the repository root path.
1. Set path to repo
The VM will create a shared volume from the content of the file `tests/resources/path_to_repo`.
Set the content of the file to the path of your abra repository.
Set the content of the file to the path of your abra repository and run the following command to prevent tracking of the file:
```sh
git update-index --assume-unchanged ./tests/resources/path_to_repo
```
This will share the repository from your machine with the VM and you can edit files while testing without rebuiling
or restarting the VM.
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# ignore changes to path_to_repo
git update-index --assume-unchanged ./tests/resources/path_to_repo
# write path to repo
pwd > ./tests/resources/path_to_repo
# create or update a VM, start it and wait for successful ping
start_vm () {
if [ -d "/var/lib/microvms/abra-$1" ]; then
make "vm-$1-update"
else
make "vm-$1-create"
fi
make "vm-$1-start"
host_available=0
while [ $host_available == 0 ]; do
if ping -c 1 "$2" &> /dev/null
then
host_available=1
else
echo "could not ping $1, waiting for 5 seconds..."
sleep 5
fi
done
}
start_vm "client" "10.0.0.2"
start_vm "server" "10.0.0.3"
read -rp "Press enter to run all tests or specify test files: " TEST_INTEGRATION_FILES
# -t option is needed for stdin output that is checked in integration tests
ssh -t abra@10.0.0.2 -i ./tests/resources/local_integration_ssh "cd abra; make test-integration TEST_INTEGRATION_FILES=$TEST_INTEGRATION_FILES"