Skip to content

Commit 177db2b

Browse files
author
Lucas Yoon
committed
adding dynamic test scripts for devfile
Signed-off-by: Lucas Yoon <[email protected]>
1 parent 7792c86 commit 177db2b

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

tests/check_non_terminating.sh

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,48 @@
22
set -o nounset
33
set -o errexit
44

5-
DEVFILES_DIR="$(pwd)/stacks"
5+
POSITIONAL_ARGS=()
6+
7+
stackDirs=''
8+
stacksPath=''
9+
10+
while [[ $# -gt 0 ]]; do
11+
case $1 in
12+
--stackDirs)
13+
stackDirs=$2
14+
shift # past argument
15+
shift
16+
;;
17+
--stacksPath)
18+
stacksPath=$2
19+
shift # past argument
20+
shift
21+
;;
22+
-*|--*)
23+
echo "Unknown option $1"
24+
exit 1
25+
;;
26+
*)
27+
POSITIONAL_ARGS+=("$1") # save positional arg
28+
shift # past argument
29+
;;
30+
esac
31+
done
32+
33+
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
34+
35+
if [ -z "$stackDirs" ]; then
36+
stackDirs=$(bash "$(pwd)/tests/get_stacks.sh")
37+
fi
38+
39+
if [ -z "$stacksPath" ]; then
40+
stacksPath="$(pwd)/stacks"
41+
fi
42+
43+
DEVFILES_DIR="$stacksPath"
644

745
# The stacks to test as a string separated by spaces
8-
STACKS=$(bash "$(pwd)/tests/get_stacks.sh")
46+
STACKS="$stackDirs"
947

1048
# Path to the check_non_terminating go package
1149
BIN_NAME=${BIN_NAME:-"flatten-parent"}

tests/validate_devfile_schemas.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ POSITIONAL_ARGS=()
44
SAMPLES="false"
55
VERBOSE="false"
66

7+
78
while [[ $# -gt 0 ]]; do
89
case $1 in
910
-s|--samples)
@@ -14,6 +15,16 @@ while [[ $# -gt 0 ]]; do
1415
VERBOSE="true"
1516
shift # past argument
1617
;;
18+
--stackDirs)
19+
stackDirs=$2
20+
shift # past argument
21+
shift
22+
;;
23+
--stacksPath)
24+
stacksPath=$2
25+
shift # past argument
26+
shift
27+
;;
1728
-*|--*)
1829
echo "Unknown option $1"
1930
exit 1
@@ -28,8 +39,15 @@ done
2839
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
2940
set -x
3041

31-
stacksDir=${STACKS_DIR:-stacks}
32-
stackDirs=${STACKS:-"$(bash "$(pwd)/tests/get_stacks.sh")"}
42+
if [ -z "$stacksPath" ]; then
43+
stacksPath=${STACKS_DIR:-stacks}
44+
fi
45+
46+
if [ -z "$stackDirs" ]; then
47+
stackDirs=${STACKS:-"$(bash "$(pwd)/tests/get_stacks.sh")"}
48+
fi
49+
50+
stacksDir="$stacksPath"
3351

3452
# Use pwd if relative path
3553
if [[ ! ${stacksDir} = /* ]]; then

0 commit comments

Comments
 (0)