-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests with one host unreachable
Signed-off-by: Blaine Gardner <[email protected]>
- Loading branch information
Showing
7 changed files
with
71 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail | ||
|
||
# Run some test hosts, and generate a node list with group "one" the first ip, "rest" the | ||
# rest of the ips and "all" set to all of the ips | ||
one="" | ||
rest="" | ||
for i in $(seq 1 $NUM_HOSTS); do | ||
host=$HOST_BASENAME-$i | ||
echo "running test host $host" | ||
docker run --rm --name "$host" --hostname "$host" --detach $IMAGE_TAG | ||
ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$host") | ||
echo "ip: $ip" | ||
if [ $i = 1 ] ; then | ||
one="$ip" | ||
else | ||
rest="$(printf '%s\n%s' "$rest" "$ip")" | ||
fi | ||
done | ||
|
||
cat << EOF > "$GROUPFILE" | ||
#!/usr/bin/env bash | ||
one='$one' | ||
rest='$rest' | ||
EOF | ||
echo 'all="$one $rest"' >> "$GROUPFILE" | ||
echo '' >> "$GROUPFILE" | ||
|
||
echo " "$GROUPFILE" file:" | ||
cat "$GROUPFILE" |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
source tests/shared.sh | ||
|
||
echo "Running tests where node 'one' is unreachable ..." | ||
|
||
NUM_REMAINING=$(( NUM_HOSTS - 1 )) | ||
|
||
assert_retcode "with run command successes on remaining nodes" 1 octopus run -g all 'hostname' | ||
assert_output_count "$HOST_BASENAME" $(( NUM_REMAINING * 2 )) | ||
|
||
assert_success "with no errors running commands on the 'rest' group" octopus run -g rest 'hostname' | ||
assert_output_count "$HOST_BASENAME" $(( NUM_REMAINING * 2 )) | ||
|
||
|
||
assert_retcode "with copy successes on remaining nodes" 1 \ | ||
octopus copy -g all -r '$HOME/tests' /tmp/1 | ||
assert_output_count "$HOST_BASENAME" $NUM_REMAINING | ||
# get md5sums of only files, then get the md5sum of the list of md5sums to keep test output short | ||
expected_md5sums="$(md5sum test/* 2>/dev/null | awk '{print $1}' | md5sum)" | ||
assert_success " and with file md5sums matching" \ | ||
octopus run -g rest 'md5sum /tmp/1/test/* 2>/dev/null | awk "{print \$1}" | md5sum' | ||
assert_output_count "$expected_md5sums" $NUM_REMAINING | ||
|
||
assert_success "with no errors copying files to the 'rest' group" \ | ||
octopus copy -g rest -r '$HOME/tests' /tmp/2 | ||
assert_success " and with file md5sums matching" \ | ||
octopus run -g rest 'md5sum /tmp/2/test/* 2>/dev/null | awk "{print \$1}" | md5sum' | ||
assert_output_count "$expected_md5sums" $NUM_REMAINING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters