Skip to content

Commit b3052d2

Browse files
committed
test: add black box test for false indeterministic checkouts
Make sure the build stops if predicted sources of deterministic checkouts do not match. Verify the legacy behaviour too.
1 parent 5b44887 commit b3052d2

File tree

8 files changed

+54
-0
lines changed

8 files changed

+54
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*/archive/
2+
*/dev/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bobMinimumVersion: "0.25"
2+
policies:
3+
failUnstableCheckouts: True
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
archive:
2+
backend: file
3+
path: archive
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root: True
2+
3+
checkoutDeterministic: True
4+
checkoutScript: |
5+
date '+%s.%N' > epoch.txt
6+
7+
buildVars: [VARIANT]
8+
buildScript: "true"
9+
packageScript: "true"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bobMinimumVersion: "0.25"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
archive:
2+
backend: file
3+
path: archive
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root: True
2+
3+
checkoutDeterministic: True
4+
checkoutScript: |
5+
date '+%s.%N' > epoch.txt
6+
7+
buildVars: [VARIANT]
8+
buildScript: "true"
9+
packageScript: "true"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -e
2+
. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; }
3+
cleanup
4+
rm -rf archive
5+
6+
# Test that indeterministic checkouts are detected when downloading artifacts.
7+
pushd new-behaviour
8+
run_bob dev root -D VARIANT=one --upload
9+
10+
# Building another variant makes sure that no artifact is found. But Bob will
11+
# still predict the checkout step. This prediction will be wrong and should be
12+
# detected.
13+
cleanup
14+
expect_fail run_bob dev root -D VARIANT=two
15+
16+
popd
17+
18+
# The old behaviour was to ignore unexpected indeterministic checkouts and just
19+
# restart the build. Verify that this is still working.
20+
pushd old-behaviour
21+
run_bob dev root -D VARIANT=one --upload
22+
cleanup
23+
run_bob dev root -D VARIANT=two
24+
popd

0 commit comments

Comments
 (0)