Skip to content

Commit 66b9e62

Browse files
Merge pull request #15 from Roblox/warning
Warn if running tests on local host.
2 parents 0d45461 + 89a59ca commit 66b9e62

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/run_tests.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
set -euo pipefail
3+
set -eo pipefail
44

55
export NOMAD_VERSION=0.11.2
66
export CONTAINERD_VERSION=1.3.4
@@ -18,6 +18,7 @@ PASS_STATUS=0
1818
# Please don't run these tests (./run_tests.sh) on your local host, as these are meant to be
1919
# destructive and can modify (or destroy) software on your host system.
2020
main() {
21+
warn_on_local_host
2122
setup
2223
echo "INFO: Checking if nomad-driver-containerd is up and running, and nomad is ready to accept jobs."
2324
is_containerd_driver_active
@@ -52,6 +53,20 @@ run_tests() {
5253
done
5354
}
5455

56+
warn_on_local_host() {
57+
if [[ -z "$CIRCLECI" || "$CIRCLECI" != "true" ]]; then
58+
echo "WARNING: Local host detected."
59+
echo "WARNING: These tests are designed to be run as part of continous integration (CI) and not recommended to be run on local host."
60+
echo "WARNING: These tests are destructive and can modify (or destroy) software on your host system."
61+
read -p "Do you still want to run the tests (Y/N)? " -n 1 -r
62+
echo
63+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
64+
echo "Right choice! Aborting..."
65+
exit 0
66+
fi
67+
fi
68+
}
69+
5570
setup() {
5671
sudo systemctl stop apt-daily-upgrade apt-daily >/dev/null 2>&1
5772

0 commit comments

Comments
 (0)