Skip to content

Commit 3a667a1

Browse files
committed
Now shows skipped tests in test output
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent dec4471 commit 3a667a1

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

tests/shell/007_install.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
if [ x"$UNSAFE_TESTS" = x1 ]
2-
then
3-
echo "Unsafe tests are enabled - running install test"
4-
else
5-
echo "Warning: Unsafe tests are disabled - skipping install test"
6-
exit 0
7-
fi
1+
source "$(dirname "$0")/common.sh"
2+
skip-unless-unsafe
83

94
set -e
105
set -x

tests/shell/common.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ git-no-diffs () {
1111
# Error if there are uncommited changes (to tracked files):
1212
git diff --exit-code
1313
}
14+
15+
skip-unless-unsafe() {
16+
if [ "${UNSAFE_TESTS:-}" != 1 ]; then
17+
local name
18+
name=$(_test_name_from_path "${BASH_SOURCE[1]:-$0}")
19+
echo "--- SKIP: $name (unsafe tests disabled) ---"
20+
exit 0
21+
fi
22+
}

0 commit comments

Comments
 (0)