Skip to content

Commit 0815513

Browse files
cf-buildpacks-engryanmoran
authored andcommitted
Updating github-config
1 parent e8ed6cf commit 0815513

File tree

1 file changed

+59
-28
lines changed

1 file changed

+59
-28
lines changed

scripts/integration.sh

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,89 @@ readonly ROOTDIR
1111
source "${ROOTDIR}/scripts/.util/tools.sh"
1212

1313
function main() {
14-
local src
14+
local src stack harness
1515
src="$(find "${ROOTDIR}/src" -mindepth 1 -maxdepth 1 -type d )"
16+
stack="$(jq -r -S .stack "${ROOTDIR}/config.json")"
17+
harness="$(jq -r -S .integration.harness "${ROOTDIR}/config.json")"
18+
19+
IFS=$'\n' read -r -d '' -a matrix < <(
20+
jq -r -S -c .integration.matrix[] "${ROOTDIR}/config.json" \
21+
&& printf "\0"
22+
)
1623

1724
util::tools::ginkgo::install --directory "${ROOTDIR}/.bin"
1825
util::tools::buildpack-packager::install --directory "${ROOTDIR}/.bin"
1926
util::tools::cf::install --directory "${ROOTDIR}/.bin"
2027

21-
local stack
22-
stack="$(jq -r -S .stack "${ROOTDIR}/config.json")"
28+
for row in "${matrix[@]}"; do
29+
local cached parallel
30+
cached="$(jq -r -S .cached <<<"${row}")"
31+
parallel="$(jq -r -S .parallel <<<"${row}")"
2332

24-
cached=true
25-
serial=true
26-
if [[ "${src}" == *python ]]; then
27-
run_specs "uncached" "parallel"
28-
run_specs "uncached" "serial"
33+
echo "Running integration suite (cached: ${cached}, parallel: ${parallel})"
2934

30-
run_specs "cached" "parallel"
31-
run_specs "cached" "serial"
32-
else
33-
run_specs "uncached" "parallel"
34-
run_specs "cached" "parallel"
35-
fi
35+
specs::run "${harness}" "${cached}" "${parallel}"
36+
done
3637
}
3738

38-
function run_specs(){
39-
local cached serial nodes
40-
41-
cached="false"
42-
serial=""
43-
nodes="${GINKGO_NODES:-3}"
39+
function specs::run() {
40+
local harness cached parallel
41+
harness="${1}"
42+
cached="${2}"
43+
parallel="${3}"
4444

45-
echo "Run ${1} Buildpack"
45+
local nodes cached_flag serial_flag
46+
cached_flag="--cached=${cached}"
47+
serial_flag="-serial=true"
48+
nodes=1
4649

47-
if [[ "${1}" == "cached" ]] ; then
48-
cached="true"
50+
if [[ "${parallel}" == "true" ]]; then
51+
nodes=3
52+
serial_flag=""
4953
fi
5054

51-
if [[ "${2}" == "serial" ]]; then
52-
nodes=1
53-
serial="-serial=true"
55+
if [[ "${harness}" == "gotest" ]]; then
56+
specs::gotest::run "${nodes}" "${cached_flag}" "${serial_flag}"
57+
else
58+
specs::ginkgo::run "${nodes}" "${cached_flag}" "${serial_flag}"
5459
fi
60+
}
61+
62+
function specs::gotest::run() {
63+
local nodes cached_flag serial_flag
64+
nodes="${1}"
65+
cached_flag="${2}"
66+
serial_flag="${3}"
67+
68+
CF_STACK="${CF_STACK:-"${stack}"}" \
69+
BUILDPACK_FILE="${UNCACHED_BUILDPACK_FILE:-}" \
70+
GOMAXPROCS="${GOMAXPROCS:-"${nodes}"}" \
71+
go test \
72+
-count=1 \
73+
-timeout=0 \
74+
-mod vendor \
75+
-v \
76+
"${src}/integration" \
77+
"${cached_flag}" \
78+
"${serial_flag}"
79+
}
80+
81+
function specs::ginkgo::run(){
82+
local nodes cached_flag serial_flag
83+
nodes="${1}"
84+
cached_flag="${2}"
85+
serial_flag="${3}"
5586

5687
CF_STACK="${CF_STACK:-"${stack}"}" \
5788
BUILDPACK_FILE="${UNCACHED_BUILDPACK_FILE:-}" \
5889
ginkgo \
5990
-r \
6091
-mod vendor \
6192
--flakeAttempts "${GINKGO_ATTEMPTS:-2}" \
62-
-nodes ${nodes} \
93+
-nodes "${nodes}" \
6394
--slowSpecThreshold 60 \
6495
"${src}/integration" \
65-
-- --cached="${cached}" ${serial}
96+
-- "${cached_flag}" "${serial_flag}"
6697
}
6798

6899
main "${@:-}"

0 commit comments

Comments
 (0)