Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2647c3331 | ||
|
|
d510e13461 | ||
|
|
470a34fdb1 |
@@ -7,3 +7,4 @@
|
||||
/bin
|
||||
dist/
|
||||
tests/integration/.bats
|
||||
tests/resources/path_to_repo
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
|
||||
Executable
+37
@@ -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"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user