Test fixture and functional test for compliance fetcher

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-12-20 07:17:48 -05:00
parent f4a3cf9144
commit 913c066be9
11 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,5 @@
control "auto-dep-on-missing-01" do
describe "a string" do
it { should cmp "a string" }
end
end

View file

@ -0,0 +1 @@
include_controls("auto-missing")

View file

@ -0,0 +1,9 @@
name: auto-dep-on-missing
title: A profile that depends on a profile that has gone missing
summary: An InSpec Compliance Profile
version: 0.1.0
supports:
platform: os
depends:
- name: auto-missing
compliance: admin/auto-missing

View file

@ -0,0 +1 @@
include_controls("basic")

View file

@ -0,0 +1,5 @@
control "missing-01" do
describe "a string" do
it { should cmp "a string" }
end
end

View file

@ -0,0 +1,9 @@
name: auto-missing
title: A profile that will be deleted from Automate
license: Apache-2.0
version: 0.1.0
supports:
platform: os
depends:
- name: basic
compliance: admin/basic

View file

@ -0,0 +1 @@
include_controls("auto-dep-on-missing")

View file

@ -0,0 +1,5 @@
control "local-dep-on-bad-archive-01" do
describe "a string" do
it { should cmp "a string" }
end
end

View file

@ -0,0 +1,8 @@
name: local-dep-on-bad-auto-archive
title: An inspec profile that has a local dep on an archive that has unresolvable deps
version: 0.1.0
supports:
platform: os
depends:
- name: auto-dep-on-missing
path: ../auto-dep-on-missing-0.1.0.tar.gz

View file

@ -91,5 +91,15 @@ describe "the fetchers" do
assert_archive_worked(run_result)
end
end
# To develop on this test, setup an Automate server, run
# `inspec compliance login`, and upload two profiles to the admin account:
# test/fixtures/profiles/fetcher-failures/{basic,auto-dep-on-missing}
describe "when using a compliance fetcher" do
let(:profile_name) { "local-dep-on-bad-auto-archive" }
it "should be able to create a new archive wrapping the profile" do
assert_archive_worked(run_result)
end
end
end
end