-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add blackbox tests for bob layers
- Loading branch information
Showing
8 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
test/black-box/layers-checkout/__layers/bar/2/recipes/bar.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packageScript: "/bin/true" | ||
provideVars: | ||
BAR_VERSION: "2" |
3 changes: 3 additions & 0 deletions
3
test/black-box/layers-checkout/__layers/baz/1/recipes/baz.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packageScript: "/bin/true" | ||
provideVars: | ||
BAZ_VERSION: "1" |
3 changes: 3 additions & 0 deletions
3
test/black-box/layers-checkout/__layers/baz/2/recipes/baz.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packageScript: "/bin/true" | ||
provideVars: | ||
BAZ_VERSION: "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
layers: | ||
- bar: | ||
checkoutSCM: | ||
scm: import | ||
url: "__layers/bar/2" | ||
- baz: | ||
checkoutSCM: | ||
scm: import | ||
url: "__layers/baz/1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
buildScript: "true" | ||
packageScript: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
layers: | ||
- foo: | ||
checkoutSCM: | ||
scm: import | ||
url: "__layers/foo" | ||
- bar: | ||
checkoutSCM: | ||
scm: git | ||
url: "file://${BAR_DIR}" | ||
commit: "${BAR_COMMIT}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root: True | ||
|
||
depends: | ||
- name: bar | ||
use: [environment] | ||
|
||
buildVars: [BAR_VERSION] | ||
buildScript: | | ||
echo "${BAR_VERSION}" > bar | ||
packageScript: | | ||
cp $1/bar . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash -e | ||
. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; } | ||
|
||
bar_dir=$(mktemp -d) | ||
trap 'rm -rf "$bar_dir" layers layers.attic log-status.txt' EXIT | ||
cleanup | ||
|
||
# build the git layer bar/1 | ||
pushd ${bar_dir} | ||
mkdir recipes | ||
cat > recipes/bar.yaml << EOF | ||
packageScript: "/bin/true" | ||
provideVars: | ||
BAR_VERSION: "1" | ||
EOF | ||
git init . | ||
git config user.email "[email protected]" | ||
git config user.name est | ||
|
||
git add . | ||
git commit -m "first commit" | ||
bar_c0=$(git rev-parse HEAD) | ||
|
||
sed -i 's/BAR_VERSION: "1"/BAR_VERSION: "3"/g' recipes/bar.yaml | ||
git commit -a -m "bump bar" | ||
bar_c1=$(git rev-parse HEAD) | ||
popd # ${bar_dir} | ||
|
||
# just build the root recipe. Layer should be fetched automatically. | ||
run_bob dev root -DBAR_COMMIT=${bar_c0} -DBAR_DIR=${bar_dir} | ||
|
||
# run update | ||
run_bob layers update -DBAR_COMMIT=${bar_c0} -DBAR_DIR=${bar_dir} | ||
|
||
# remove layers + clean | ||
cleanup | ||
rm -rf layers | ||
|
||
# run update - should fetch layers | ||
run_bob layers update -DBAR_COMMIT=${bar_c0} -DBAR_DIR=${bar_dir} | ||
|
||
# make some changes in layers | ||
echo "#foo" >> layers/bar/recipes/bar.yaml | ||
|
||
run_bob layers status -DBAR_COMMIT=${bar_c0} -DBAR_DIR=${bar_dir} | tee log-status.txt | ||
grep -q 'STATUS.\+M.\+[/\]bar' log-status.txt | ||
|
||
# update bar to new revision (bar will be moved to attic) | ||
run_bob layers update -DBAR_COMMIT=${bar_c1} -DBAR_DIR=${bar_dir} | ||
expect_exist layers.attic | ||
|
||
bar_now=$(git -C layers/bar rev-parse HEAD) | ||
expect_equal ${bar_c1} ${bar_now} |