Add --interactive mode to docker-tests for testing of interactive commands (#312)
* Add --interactive mode to docker-tests to facilitate interactive testing of innernet commands. * Add a section to README about testing. * Fix href tagpull/317/head
parent
3c69de4e4e
commit
85c8cc37ec
13
README.md
13
README.md
|
@ -253,6 +253,19 @@ cargo build --release --bin innernet
|
||||||
|
|
||||||
The resulting binary will be located at `./target/release/innernet`
|
The resulting binary will be located at `./target/release/innernet`
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
You can manually invoke Docker-based tests assuming you have Docker daemon running. If you specify
|
||||||
|
`--interactive` flag, it allows you to attach to the server and client innernet Docker
|
||||||
|
containers, so you can test various innernet commands inside a sandboxed environment.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-tests/build-docker-images.sh
|
||||||
|
docker-tests/run-docker-tests.sh [--interactive]
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are developing a new feature, please consider adding a new test case to `run-docker-tests.sh` ([example PR](https://github.com/tonarino/innernet/pull/310/files#diff-5d47ea0d379e45f35471e2afa48fdba09d2ca4bcf090e16bb1adccebea080081)).
|
||||||
|
|
||||||
### Releases
|
### Releases
|
||||||
|
|
||||||
Please run the release script from a Linux machine: generated shell completions depend on available wireguard backends and Mac doesn't support the `kernel` backend.
|
Please run the release script from a Linux machine: generated shell completions depend on available wireguard backends and Mac doesn't support the `kernel` backend.
|
||||||
|
|
|
@ -8,14 +8,19 @@ cd "$SELF_DIR/.."
|
||||||
help() {
|
help() {
|
||||||
cat >&2 <<-_EOF
|
cat >&2 <<-_EOF
|
||||||
Usage: "${0##*/}" [options...] (<test>)
|
Usage: "${0##*/}" [options...] (<test>)
|
||||||
--userspace Use userspace wireguard instead of kernel one
|
--interactive Enter interactive mode, providing a chance to attach to innernet docker containers
|
||||||
--verbose Print verbose innernet logs
|
--userspace Use userspace wireguard instead of kernel one
|
||||||
|
--verbose Print verbose innernet logs
|
||||||
_EOF
|
_EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_FILTER=()
|
TEST_FILTER=()
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
--interactive)
|
||||||
|
INTERACTIVE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--userspace)
|
--userspace)
|
||||||
INNERNET_ARGS="$INNERNET_ARGS --backend userspace"
|
INNERNET_ARGS="$INNERNET_ARGS --backend userspace"
|
||||||
shift
|
shift
|
||||||
|
@ -135,6 +140,18 @@ cmd docker cp "$tmp_dir/peer2.toml" "$PEER2_CONTAINER:/app/invite.toml"
|
||||||
cmd docker start -a "$PEER2_CONTAINER" | sed -e 's/^/\x1B[0;93mpeer 2\x1B[0m: /' &
|
cmd docker start -a "$PEER2_CONTAINER" | sed -e 's/^/\x1B[0;93mpeer 2\x1B[0m: /' &
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
|
if [[ $INTERACTIVE == true ]]; then
|
||||||
|
info "Open a new terminal and connect to one of the docker containers to test innernet commands."
|
||||||
|
info ""
|
||||||
|
info "Server:"
|
||||||
|
info " docker exec -it ${SERVER_CONTAINER:0:12} bash"
|
||||||
|
info "Admin client:"
|
||||||
|
info " docker exec -it ${PEER1_CONTAINER:0:12} bash"
|
||||||
|
info "Non-admin client:"
|
||||||
|
info " docker exec -it ${PEER2_CONTAINER:0:12} bash"
|
||||||
|
wait
|
||||||
|
fi
|
||||||
|
|
||||||
test_short_lived_invitation() {
|
test_short_lived_invitation() {
|
||||||
info "Creating short-lived invitation for third peer."
|
info "Creating short-lived invitation for third peer."
|
||||||
cmd docker exec "$PEER1_CONTAINER" innernet \
|
cmd docker exec "$PEER1_CONTAINER" innernet \
|
||||||
|
|
Loading…
Reference in New Issue