-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
2 changed files
with
107 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/env bats | ||
|
||
setup() { | ||
load setup_common | ||
load setup_container_daemon | ||
} | ||
|
||
teardown() { | ||
load teardown_container_daemon | ||
load teardown_common | ||
} | ||
|
||
@test "Checking that internal environment variables are exposed when logging in..." { | ||
exec_container_daemon sh -c "[ -f /root/.profile ] && . /root/.profile || . /root/.docker_rc; env | grep -w XDG_DATA_HOME" | ||
} | ||
|
||
# vim:ft=sh:ts=4:sw=4:et:sts=4 |
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,90 @@ | ||
#!/bin/env bats | ||
|
||
setup() { | ||
load setup_common | ||
|
||
echo "#!/bin/sh | ||
exit 0" > "$TESTS_WORKDIR"/startapp.sh | ||
chmod a+rx "$TESTS_WORKDIR"/startapp.sh | ||
} | ||
|
||
teardown() { | ||
load teardown_common | ||
} | ||
|
||
@test "Checking that packages mirror can be set successfully..." { | ||
docker_run --rm -e "PACKAGES_MIRROR=https://example.com" -v "$TESTS_WORKDIR"/startapp.sh:/startapp.sh $DOCKER_IMAGE | ||
echo "=====================================================================" | ||
echo " OUTPUT" | ||
echo "=====================================================================" | ||
echo "$output" | ||
echo "=====================================================================" | ||
echo " END OUTPUT" | ||
echo "=====================================================================" | ||
echo "STATUS: $status" | ||
[ "$status" -eq 0 ] | ||
|
||
regex=".* setting packages mirror to 'https://example.com'" | ||
for item in "${lines[@]}"; do | ||
if [[ "$item" =~ $regex ]]; then | ||
break; | ||
fi | ||
done | ||
[[ "$item" =~ $regex ]] | ||
} | ||
|
||
@test "Checking that package can be installed successfully when a mirror is set..." { | ||
docker_run --rm $DOCKER_IMAGE uname -m | ||
[ "$status" -eq 0 ] | ||
ARCH="${lines[0]}" | ||
|
||
docker_run --rm $DOCKER_IMAGE cat /etc/os-release | ||
[ "$status" -eq 0 ] | ||
|
||
regex="^ID=.*" | ||
for item in "${lines[@]}"; do | ||
if [[ "$item" =~ $regex ]]; then | ||
OS="${item#*=}" | ||
break; | ||
fi | ||
done | ||
|
||
case "$OS" in | ||
alpine) | ||
MIRROR="http://uk.alpinelinux.org/alpine/" | ||
;; | ||
debian) | ||
MIRROR="http://ftp.us.debian.org/debian/" | ||
;; | ||
ubuntu) | ||
case "$ARCH" in | ||
i386|i686|x86_64) | ||
MIRROR="http://mirror.math.princeton.edu/pub/ubuntu/" | ||
;; | ||
*) | ||
MIRROR="http://in.mirror.coganng.com/ubuntu-ports/" | ||
;; | ||
esac | ||
;; | ||
arch) | ||
MIRROR="http://arch.mirror.square-r00t.net" | ||
;; | ||
*) | ||
echo "ERROR: Unknown OS '$OS'." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
docker_run --rm -e "PACKAGES_MIRROR=$MIRROR" -e "INSTALL_PACKAGES=patchelf" -v "$TESTS_WORKDIR"/startapp.sh:/startapp.sh $DOCKER_IMAGE | ||
echo "=====================================================================" | ||
echo " OUTPUT" | ||
echo "=====================================================================" | ||
echo "$output" | ||
echo "=====================================================================" | ||
echo " END OUTPUT" | ||
echo "=====================================================================" | ||
echo "STATUS: $status" | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
# vim:ft=sh:ts=4:sw=4:et:sts=4 |