-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·151 lines (111 loc) · 5.44 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
set -x
# grep returns 0 if found, 1 if not
function check_for_caching_result() {
local file="$1"
local desired_result="$2"
grep -q 'enableCache: true' "$file"
grep_result=$?
# grep returns 0 if found, 1 if not
if [ "$grep_result" -ne "$desired_result" ]; then
echo "Test failed!"
exit 1
fi
}
ENABLED=0
DISABLED=1
# base cases -- nothing has changed
rm -f output.yaml
kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
kfp dsl compile --py ./pipeline_caching_false.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
# use the CLI compiler, set the env var in various ways
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=true kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=True kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT="True" kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT="YES" kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=On kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=False kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
# check the true and false in the DSL cases too
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 kfp dsl compile --py ./pipeline_caching_true.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 kfp dsl compile --py ./pipeline_caching_true.py --output output.yaml
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 kfp dsl compile --py ./pipeline_caching_false.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 kfp dsl compile --py ./pipeline_caching_false.py --output output.yaml
check_for_caching_result output.yaml $DISABLED
# use the CLI compiler, set the cli flag
rm -f output.yaml
kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml --disable-execution-caching-by-default
check_for_caching_result output.yaml $DISABLED
# use the CLI compiler, set the cli flag, and make sure it overrides any env var
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 kfp dsl compile --py ./pipeline_caching_unset.py --output output.yaml --disable-execution-caching-by-default
check_for_caching_result output.yaml $DISABLED
# use compiler.Compile(), set the env var in various ways
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=true python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=True python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT="True" python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT="YES" python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=On python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=False python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 python ./pipeline_caching_unset_compile.py
check_for_caching_result output.yaml $ENABLED
# check the true and false in the DSL cases too
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 python ./pipeline_caching_true_compile.py
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 python ./pipeline_caching_true_compile.py
check_for_caching_result output.yaml $ENABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=0 python ./pipeline_caching_false_compile.py
check_for_caching_result output.yaml $DISABLED
rm -f output.yaml
KFP_DISABLE_EXECUTION_CACHING_BY_DEFAULT=1 python ./pipeline_caching_false_compile.py
check_for_caching_result output.yaml $DISABLED
echo "Test passed!"