@@ -18,17 +18,19 @@ function usage() {
1818integration.sh --github-token <token> [OPTIONS]
1919Runs the integration tests.
2020OPTIONS
21- --help -h prints the command usage
22- --github-token <token> GitHub token to use when making API requests
23- --platform <cf|docker> Switchblade platform to execute the tests against
21+ --help -h prints the command usage
22+ --github-token <token> GitHub token to use when making API requests
23+ --platform <cf|docker> Switchblade platform to execute the tests against
24+ --keep-failed-containers Preserve failed test containers for debugging (default: false)
2425USAGE
2526}
2627
2728function main() {
28- local src stack platform token cached parallel
29+ local src stack platform token cached parallel keep_failed
2930 src=" $( find " ${ROOTDIR} /src" -mindepth 1 -maxdepth 1 -type d ) "
3031 stack=" ${CF_STACK:- $(jq -r -S .stack " ${ROOTDIR} /config.json" )} "
3132 platform=" cf"
33+ keep_failed=" false"
3234
3335 while [[ " ${# } " != 0 ]]; do
3436 case " ${1} " in
@@ -52,6 +54,11 @@ function main() {
5254 shift 2
5355 ;;
5456
57+ --keep-failed-containers)
58+ keep_failed=" true"
59+ shift 1
60+ ;;
61+
5562 --help|-h)
5663 shift 1
5764 usage
@@ -94,31 +101,37 @@ function main() {
94101
95102 echo " Running integration suite (cached: ${cached} , parallel: ${parallel} )"
96103
97- specs::run " ${cached} " " ${parallel} " " ${stack} " " ${platform} " " ${token:- } "
104+ specs::run " ${cached} " " ${parallel} " " ${stack} " " ${platform} " " ${token:- } " " ${keep_failed} "
98105 done
99106}
100107
101108function specs::run() {
102- local cached parallel stack platform token
109+ local cached parallel stack platform token keep_failed
103110 cached=" ${1} "
104111 parallel=" ${2} "
105112 stack=" ${3} "
106113 platform=" ${4} "
107114 token=" ${5} "
115+ keep_failed=" ${6} "
108116
109- local nodes cached_flag serial_flag platform_flag stack_flag token_flag
117+ local nodes cached_flag serial_flag platform_flag stack_flag token_flag keep_failed_flag
110118 cached_flag=" --cached=${cached} "
111119 serial_flag=" --serial=true"
112120 platform_flag=" --platform=${platform} "
113121 stack_flag=" --stack=${stack} "
114122 token_flag=" --github-token=${token} "
123+ keep_failed_flag=" "
115124 nodes=1
116125
117126 if [[ " ${parallel} " == " true" ]]; then
118127 nodes=3
119128 serial_flag=" "
120129 fi
121130
131+ if [[ " ${keep_failed} " == " true" ]]; then
132+ keep_failed_flag=" --keep-failed-containers"
133+ fi
134+
122135 local buildpack_file
123136 buildpack_file=" $( buildpack::package " 1.2.3" " ${cached} " " ${stack} " ) "
124137
@@ -131,11 +144,12 @@ function specs::run() {
131144 -mod vendor \
132145 -v \
133146 " ${src} /integration" \
134- " ${cached_flag} " \
135- " ${platform_flag} " \
136- " ${token_flag} " \
137- " ${stack_flag} " \
138- " ${serial_flag} "
147+ ${cached_flag} \
148+ ${platform_flag} \
149+ ${token_flag} \
150+ ${stack_flag} \
151+ ${serial_flag} \
152+ ${keep_failed_flag}
139153}
140154
141155function buildpack::package() {
0 commit comments