forked from LINBIT/virter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
186 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mocks | ||
|
||
/virter | ||
|
||
/tests/vms.toml |
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,3 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk add openssh-client |
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,33 @@ | ||
#!/usr/bin/env bash | ||
# Generate a vms.toml for vmshed, using known base images. | ||
set -e | ||
|
||
cat <<EOF | ||
name = "smoke" | ||
provision_file = "provision.toml" | ||
provision_timeout = "2m" | ||
provision_memory = "1G" | ||
provision_cpus = 1 | ||
EOF | ||
|
||
while read -r name url; do | ||
if echo "$name" | grep -q -E "^($EXCLUDED_BASE_IMAGES)\$" ; then | ||
echo "$name was excluded" >&2 | ||
continue | ||
fi | ||
|
||
if [ -n "$PULL_LOCATION" ]; then | ||
virter image pull "$name" "$PULL_LOCATION/$name" >&2 | ||
else | ||
virter image pull "$name" >&2 | ||
fi | ||
|
||
cat <<EOF | ||
[[vms]] | ||
vcpus = 1 | ||
memory = "1G" | ||
base_image = "$name" | ||
EOF | ||
|
||
done < <(virter image ls --available | tail -n +2) |
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,3 @@ | ||
ABCDEFGHIJKLMNOPQRSTUVWXYZ | ||
abcdefghijklmnopqrstuvwxyz | ||
0123456789 |
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 @@ | ||
134d9234f01411b06bd56ebb4b7ae6208444bc26a91f5755cc9a07131ed78c39 example.txt |
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,16 @@ | ||
[[steps]] | ||
[steps.shell] | ||
script = """ | ||
set -ex | ||
if ! command -v rsync ; then | ||
if command -v apt-get ; then | ||
apt-get update | ||
apt-get install -y rsync | ||
elif command -v dnf ; then | ||
dnf install -y rsync | ||
elif command -v yum ; then | ||
yum install -y rsync | ||
fi | ||
fi | ||
""" |
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,59 @@ | ||
[values] | ||
DockerImage = "ssh" | ||
|
||
# Check that rsync steps work | ||
[[steps]] | ||
[steps.rsync] | ||
source = "data/" | ||
dest = "/virter" | ||
|
||
# Check that docker steps work | ||
[[steps]] | ||
[steps.docker] | ||
image = "{{ .DockerImage }}" | ||
command = ["sh", "-exc", """ | ||
mkdir -p /virter/out | ||
test -n "$TARGETS" | ||
IFS=,; for t in $TARGETS; do | ||
test "$t" = "$(ssh $t hostname -s)" | ||
scp -r $t:/virter/example.txt example.txt | ||
sha256sum -c /virter/workspace/data/example.txt.sha256sum | ||
mv example.txt /virter/out/example-$t.txt | ||
done | ||
"""] | ||
[steps.docker.copy] | ||
source = "/virter/out" | ||
dest = "{{ .OutDir }}" | ||
|
||
# Checks that the previous docker step copied files as expected | ||
[[steps]] | ||
[steps.docker] | ||
image = "{{ .DockerImage }}" | ||
command = ["sh", "-exc", """ | ||
IFS=,; for t in $TARGETS; do | ||
test -f "/virter/workspace/{{ .OutDir }}/out/example-$t.txt" | ||
done | ||
"""] | ||
|
||
# Checks that shell steps work as expected | ||
[[steps]] | ||
[steps.shell] | ||
script = """ | ||
set -ex | ||
test -f /virter/example.txt | ||
cd /virter | ||
sha256sum -c example.txt.sha256sum | ||
# CentOS 6 doesn't use systemd, Upstart is a mess, so don't even bother... | ||
[ command -v systemctl ] || exit 0 | ||
while true; do | ||
running=$(systemctl is-system-running || true) | ||
[ "$running" = initializing -o "$running" = starting ] && { sleep 1; continue; } | ||
[ "$running" = running ] && break | ||
echo "System in unexpected state '$running'; failed units:" 1>&2 | ||
systemctl list-units --failed 1>&2 | ||
exit 1 | ||
done | ||
""" |
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,12 @@ | ||
test_suite_file = "test-run.toml" | ||
test_timeout = "1m" | ||
artifacts = [ | ||
"/var/log/journal", | ||
"/var/log/messages", | ||
"/run/log/journal", | ||
] | ||
|
||
[tests] | ||
[tests.smoke] | ||
vms = [1] | ||
needallplatforms = true |