mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Test fixture for url fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
1eb33049e4
commit
ed209643f3
8 changed files with 49 additions and 6 deletions
|
@ -0,0 +1 @@
|
|||
include_controls("url-deps-on-missing")
|
5
test/fixtures/profiles/fetcher-failures/local-dep-on-bad-url-archive/controls/local-dep.rb
vendored
Normal file
5
test/fixtures/profiles/fetcher-failures/local-dep-on-bad-url-archive/controls/local-dep.rb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
control "local-dep-01" do
|
||||
describe "a string" do
|
||||
it { should cmp "a string" }
|
||||
end
|
||||
end
|
9
test/fixtures/profiles/fetcher-failures/local-dep-on-bad-url-archive/inspec.yml
vendored
Normal file
9
test/fixtures/profiles/fetcher-failures/local-dep-on-bad-url-archive/inspec.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: local-dep-on-bad-url-archive
|
||||
license: Apache-2.0
|
||||
summary: An InSpec profile that depends on an archive that has unresolvable URL deps
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
||||
depends:
|
||||
- name: url-deps-on-missing
|
||||
path: ../url-deps-on-missing-0.1.0.tar.gz
|
BIN
test/fixtures/profiles/fetcher-failures/url-deps-on-missing-0.1.0.tar.gz
vendored
Normal file
BIN
test/fixtures/profiles/fetcher-failures/url-deps-on-missing-0.1.0.tar.gz
vendored
Normal file
Binary file not shown.
5
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/controls/deps-on-missing.rb
vendored
Normal file
5
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/controls/deps-on-missing.rb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
control "deps-on-missing-01" do
|
||||
describe "a string" do
|
||||
it { should cmp "a string" }
|
||||
end
|
||||
end
|
1
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/controls/include-missing.rb
vendored
Normal file
1
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/controls/include-missing.rb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
include_controls("inspec-test-profile-missing")
|
10
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/inspec.yml
vendored
Normal file
10
test/fixtures/profiles/fetcher-failures/url-deps-on-missing/inspec.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: url-deps-on-missing
|
||||
maintainer: InSpec Team
|
||||
license: Apache-2.0
|
||||
summary: An InSpec profile that has a dependency on an unresolvable URL
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
||||
depends:
|
||||
- name: inspec-test-profile-missing
|
||||
url: https://github.com/inspec/inspec-test-profile-missing/archive/0.1.0.tar.gz
|
|
@ -58,19 +58,31 @@ describe "the fetchers" do
|
|||
# Refs #4727
|
||||
describe "when a archive is available of an unfetchable profile with --airgap" do
|
||||
|
||||
let(:invocation) { "archive #{path} --airgap" }
|
||||
let(:path) { "#{fetcher_profiles}/local-dep-on-bad-git-archive" }
|
||||
let(:invocation) { "archive #{fetcher_profiles}/#{profile_name} --airgap" }
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf "#{path}/vendor"
|
||||
FileUtils.rm_rf "#{fetcher_profiles}/local-dep-on-bad-git-archive-0.1.0.tar.gz"
|
||||
FileUtils.rm_rf "#{fetcher_profiles}/#{profile_name}/vendor"
|
||||
FileUtils.rm "#{profile_name}-0.1.0.tar.gz"
|
||||
end
|
||||
|
||||
it "should be able to create a new archive wrapping the profile" do
|
||||
# Cannot be parallelized - must purge cache to test properly
|
||||
def assert_archive_worked(run_result)
|
||||
_(run_result.stderr).must_be_empty
|
||||
_(run_result.stdout).must_include "Finished archive generation"
|
||||
assert_exit_code(0, run_result)
|
||||
end
|
||||
|
||||
describe "when using a git fetcher" do
|
||||
let(:profile_name) { "local-dep-on-bad-git-archive" }
|
||||
it "should be able to create a new archive wrapping the profile" do
|
||||
assert_archive_worked(run_result)
|
||||
end
|
||||
end
|
||||
|
||||
describe "when using a url fetcher" do
|
||||
let(:profile_name) { "local-dep-on-bad-url-archive" }
|
||||
it "should be able to create a new archive wrapping the profile" do
|
||||
assert_archive_worked(run_result)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue