Skip to content

Commit 3f1eee9

Browse files
committed
Added tests for cfbs update for modules added by url.
Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent a7dbdb9 commit 3f1eee9

4 files changed

Lines changed: 72 additions & 0 deletions

File tree

tests/shell/042_update_from_url.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
rm -rf delete-files
9+
10+
cp ../shell/042_update_from_url/example-cfbs.json cfbs.json
11+
cp -r ../shell/042_update_from_url/delete-files .
12+
13+
cfbs --loglevel=debug update
14+
grep 'Specify another file you want deleted on your hosts?' delete-files/input.json
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"type": "list",
4+
"variable": "files",
5+
"namespace": "delete_files",
6+
"bundle": "delete_files",
7+
"label": "Files",
8+
"subtype": [
9+
{
10+
"key": "path",
11+
"type": "string",
12+
"label": "Path",
13+
"question": "Path to file"
14+
}
15+
],
16+
"while": "test?",
17+
"response" : ["/tmp/file"]
18+
}
19+
]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "Example project",
3+
"description": "Example description",
4+
"type": "policy-set",
5+
"git": true,
6+
"build": [
7+
{
8+
"name": "delete-files",
9+
"description": "Allows you to specify a list of files you want deleted on hosts in your infrastructure. When this module is deployed as part of your policy set, every time CFEngine runs, it will check if those files exist, and delete them if they do.",
10+
"url": "https://github.com/nickanderson/cfengine-delete-files.git",
11+
"commit": "0000000000000000000000000000000000000000",
12+
"added_by": "cfbs add",
13+
"steps": [
14+
"copy delete-files.cf services/cfbs/modules/delete-files/delete-files.cf",
15+
"input delete-files/input.json def.json",
16+
"something test"
17+
],
18+
"input": [
19+
{
20+
"type": "list",
21+
"variable": "files",
22+
"namespace": "delete_files",
23+
"bundle": "delete_files",
24+
"label": "Files",
25+
"subtype": [
26+
{
27+
"key": "path",
28+
"type": "string",
29+
"label": "Path",
30+
"question": "Path to file"
31+
}
32+
],
33+
"while": "test?"
34+
}
35+
]
36+
}
37+
]
38+
}

tests/shell/all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ bash tests/shell/038_global_dir.sh
4545
bash tests/shell/039_add_added_by_field_update_1.sh
4646
bash tests/shell/040_add_added_by_field_update_2.sh
4747
bash tests/shell/041_add_multidep.sh
48+
bash tests/shell/042_update_from_url.sh
4849

4950
echo "All cfbs shell tests completed successfully!"

0 commit comments

Comments
 (0)