Skip to content

Commit 9816ead

Browse files
committed
Added tests for cfbs add absolute path
Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent 906fa25 commit 9816ead

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
set -e
2+
set -x
3+
cd tests/
4+
mkdir -p ./tmp
5+
cd ./tmp/
6+
touch cfbs.json && rm cfbs.json
7+
rm -rf .git
8+
9+
cleanup() {
10+
rm -rf /tmp/foo
11+
}
12+
trap cleanup EXIT QUIT TERM
13+
mkdir -p /tmp/foo
14+
15+
export GIT_AUTHOR_NAME="github_actions"
16+
export GIT_AUTHOR_EMAIL="github_actions@example.com"
17+
18+
# Add first commit
19+
cp -r ../sample/foo/main.cf /tmp/foo/foo.cf
20+
git init /tmp/foo
21+
cd /tmp/foo
22+
git add /tmp/foo/foo.cf
23+
git -c user.name="$GIT_AUTHOR_NAME" -c user.email="$GIT_AUTHOR_EMAIL" commit -m "initial commit"
24+
head_commit=$(git rev-parse HEAD)
25+
cd -
26+
27+
# run cfbs
28+
cfbs --non-interactive init --masterfiles no
29+
cfbs --non-interactive add /tmp/foo
30+
cfbs build
31+
32+
grep "$head_commit" cfbs.json
33+
34+
# Add second commit
35+
cp ../sample/bar/baz/main.cf /tmp/foo/baz.cf
36+
cd /tmp/foo
37+
git add /tmp/foo/baz.cf
38+
git -c user.name="$GIT_AUTHOR_NAME" -c user.email="$GIT_AUTHOR_EMAIL" commit -m "second commit"
39+
head_commit=$(git rev-parse HEAD)
40+
cd -
41+
42+
# run cfbs
43+
cfbs --non-interactive update
44+
cfbs build
45+
46+
grep "$head_commit" cfbs.json

tests/shell/all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ bash tests/shell/043_replace_version.sh
5050
bash tests/shell/044_replace.sh
5151
bash tests/shell/045_update_from_url_branch_uptodate.sh
5252
bash tests/shell/046_update_from_url_branch.sh
53+
bash tests/shell/047_absolute_path_modules.sh
5354

5455
echo "All cfbs shell tests completed successfully!"

0 commit comments

Comments
 (0)