Skip to content

Commit

Permalink
Modify 016_add_folders shell test
Browse files Browse the repository at this point in the history
Modify 016_add_folders shell test to work with changes from CFE-3990.

Ticket: CFE-3990
Changelog: None
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
  • Loading branch information
larsewi committed Oct 18, 2022
1 parent ad93093 commit 5f03bc8
Showing 1 changed file with 28 additions and 37 deletions.
65 changes: 28 additions & 37 deletions tests/shell/016_add_folders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,54 @@ mkdir -p ./tmp/
cd ./tmp/
touch cfbs.json && rm cfbs.json
rm -rf .git
rm -rf one
rm -rf two

mkdir one
echo '
bundle agent bundle_one
{
meta:
"tags" slist => { "autorun" };
mkdir -p doofus
echo 'bundle agent doofus {
reports:
"one";
"This is $(this.promise_filename):$(this.bundle)!";
}
' > one/policy.cf
echo '{}
' > one/data.json
' > doofus/doofus.cf

mkdir two
mkdir two/three
echo '
bundle agent bundle_two
{
meta:
"tags" slist => { "autorun" };
mkdir -p foo
echo 'bundle agent foo {
reports:
"two";
"This is $(this.promise_filename):$(this.bundle)!";
}
' > two/three/policy.cf
' > doofus/foo/foo.cf

echo '{}
' > doofus/data.json

echo '{
"vars": {
"foo_thing": "awesome"
}
}
' > two/three/def.json
echo 'Hello
' > two/three/file.txt
' > doofus/foo/def.json

cfbs --non-interactive init
cfbs status

cfbs --non-interactive add ./one
cfbs --non-interactive add ./two/
cfbs --non-interactive add ./doofus/
cfbs status

cfbs status | grep "./one/"
cfbs status | grep "./two/"
cat cfbs.json | grep "directory ./ services/cfbs/one/"
cat cfbs.json | grep "directory ./ services/cfbs/two/"
cfbs status | grep "./doofus/"
grep '"name": "./doofus/"' cfbs.json
grep '"directory ./ services/cfbs/doofus/"' cfbs.json
grep '"policy_files ./doofus/"' cfbs.json
grep '"bundles doofus"' cfbs.json

cfbs build

ls out/masterfiles/services/cfbs/one
grep "bundle_one" out/masterfiles/services/cfbs/one/policy.cf
ls out/masterfiles/services/cfbs/one/data.json
grep '"inputs"' out/masterfiles/def.json
grep '"services/cfbs/doofus/doofus.cf"' out/masterfiles/def.json
grep '"services/cfbs/doofus/foo/foo.cf"' out/masterfiles/def.json

grep '"control_common_bundlesequence_end"' out/masterfiles/def.json
grep '"doofus"' out/masterfiles/def.json

ls out/masterfiles/services/cfbs/two
grep "bundle_two" out/masterfiles/services/cfbs/two/policy.cf
grep "Hello" out/masterfiles/services/cfbs/two/file.txt
grep '"foo_thing": "awesome"' out/masterfiles/def.json

grep "awesome" out/masterfiles/def.json
ls out/masterfiles/services/cfbs/doofus/doofus.cf
ls out/masterfiles/services/cfbs/doofus/foo/foo.cf

0 comments on commit 5f03bc8

Please sign in to comment.