From ba21ca9fe600c7615e22b98348871174b77fee9c Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Mon, 28 Aug 2023 15:22:25 -0500 Subject: [PATCH] basic docker-based test to run locally and eventually in github actions --- cfbs.json | 4 +--- ci/docker.sh | 3 +++ tests/www-test.cf | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100755 ci/docker.sh diff --git a/cfbs.json b/cfbs.json index d3cf39e..1f367a1 100644 --- a/cfbs.json +++ b/cfbs.json @@ -20,9 +20,7 @@ "tags": ["local"], "added_by": "cfbs add", "steps": [ - "directory ./ services/cfbs/tests/", - "policy_files services/cfbs/tests/", - "bundles __main__" + "directory ./ services/cfbs/tests/" ] }, { diff --git a/ci/docker.sh b/ci/docker.sh new file mode 100755 index 0000000..d43a114 --- /dev/null +++ b/ci/docker.sh @@ -0,0 +1,3 @@ +cfbs build +docker run -v ./out/masterfiles:/var/lib/cfengine/inputs -it agent cf-promises +docker run -v ./out/masterfiles:/var/lib/cfengine/inputs -it agent cf-agent -KIf services/cfbs/tests/www-test.cf diff --git a/tests/www-test.cf b/tests/www-test.cf index 22dfd84..b128b9f 100644 --- a/tests/www-test.cf +++ b/tests/www-test.cf @@ -3,7 +3,7 @@ body file control { inputs => { "${sys.libdir}/testing.cf", - "$(sys.policy_entry_dirname)/../../policy/www.cf" + "$(sys.policy_entry_dirname)/../policy/www.cf" }; } @@ -16,7 +16,8 @@ bundle agent test bundle agent check { classes: - "dir_exists" expression => isdir("/src/www"); + "dir_exists" expression => isdir("/src/www/."), + scope => "namespace"; # make global for use by testing.cf methods: "Register test case"