Skip to content

Commit b03033f

Browse files
committed
test: add bundle blackbox test
1 parent cc2227e commit b03033f

File tree

5 files changed

+128
-0
lines changed

5 files changed

+128
-0
lines changed

Diff for: test/black-box/bundle/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_input/
2+
test_bundle.tar

Diff for: test/black-box/bundle/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bobMinimumVersion: "0.25.1.dev40"

Diff for: test/black-box/bundle/recipes/bundle.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root: True
2+
3+
depends:
4+
- input-a
5+
- input-b
6+
- input-c
7+
- input-d
8+
- name: input-indeterministic
9+
if: ${TEST_INDETERMINISTIC_INPUT:-False}
10+
11+
checkoutDeterministic: True
12+
checkoutScript: |
13+
echo "it works" >> bundled_script.txt
14+
15+
buildScript: |
16+
cat $1/bundled_script.txt
17+
18+
packageScript: |
19+
/bin/true

Diff for: test/black-box/bundle/recipes/input.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
multiPackage:
2+
"a":
3+
checkoutSCM:
4+
scm: url
5+
url: "${INPUT_BASE}/a/test.tgz"
6+
digestSHA1: "${INPUT_A_DIGEST}"
7+
stripComponents: 1
8+
"b":
9+
checkoutSCM:
10+
scm: url
11+
url: "${INPUT_BASE}/b/test.tgz"
12+
digestSHA1: "${INPUT_B_DIGEST}"
13+
stripComponents: 1
14+
"c":
15+
checkoutSCM:
16+
scm: url
17+
url: "${INPUT_BASE}/c/test.tgz"
18+
digestSHA1: "${INPUT_C_DIGEST}"
19+
stripComponents: 1
20+
"d":
21+
checkoutSCM:
22+
scm: url
23+
url: "${INPUT_BASE}/d/test.tgz"
24+
digestSHA1: "${INPUT_D_DIGEST}"
25+
stripComponents: 1
26+
"indeterministic":
27+
checkoutScript: |
28+
echo foo
29+
30+
buildScript: |
31+
/bin/true
32+
33+
packageScript: |
34+
/bin/true

Diff for: test/black-box/bundle/run.sh

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash -e
2+
. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; }
3+
4+
cleanup
5+
rm -f test_bundle.tar
6+
7+
trap 'rm -f test_bundle.tar' EXIT
8+
9+
# generate some input
10+
if [[ ! -d _input ]]; then
11+
mkdir -p _input
12+
pushd _input
13+
mkdir -p a b c d
14+
15+
for x in a b c d; do
16+
dd if=/dev/urandom of=$x/test.dat bs=1M count=10
17+
tar czf $x/test.tgz $x/test.dat
18+
done
19+
20+
popd # _input
21+
fi
22+
23+
run_bob dev bundle -j 5 \
24+
-DINPUT_BASE="$PWD/_input" \
25+
-DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \
26+
-DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \
27+
-DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \
28+
-DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)"
29+
expect_exist dev/src/input/1/download
30+
31+
run_bob dev bundle -j 5 \
32+
-DINPUT_BASE="$PWD/_input" \
33+
-DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \
34+
-DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \
35+
-DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \
36+
-DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \
37+
--bundle test_bundle.tar
38+
expect_exist test_bundle.tar
39+
40+
cleanup
41+
rm -f test_bundle.tar
42+
43+
run_bob dev bundle -j 5 \
44+
-DINPUT_BASE="$PWD/_input" \
45+
-DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \
46+
-DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \
47+
-DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \
48+
-DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \
49+
--bundle test_bundle.tar
50+
expect_exist test_bundle.tar
51+
52+
cleanup
53+
run_bob dev bundle -j 5 \
54+
-DINPUT_BASE="/notexisting" \
55+
-DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \
56+
-DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \
57+
-DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \
58+
-DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \
59+
--bundle test_bundle.tar --unbundle
60+
expect_not_exist dev/src/input/1/download/
61+
62+
cleanup
63+
rm -f test_bundle.tar
64+
65+
expect_fail run_bob dev bundle -j 5 \
66+
-DINPUT_BASE="$PWD/_input" \
67+
-DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \
68+
-DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \
69+
-DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \
70+
-DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \
71+
-DTEST_INDETERMINISTIC_INPUT=True \
72+
--bundle test_bundle.tar

0 commit comments

Comments
 (0)