From 860d21a37036da7b00cf19062b01c4f19bef2191 Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Tue, 18 Jun 2019 15:22:14 -0400 Subject: [PATCH] Test for ./ Signed-off-by: Clinton Wolfe --- test/functional/git_fetcher_test.rb | 13 +++++++++++-- .../controls/relative-dot-slash.rb | 7 +++++++ .../git-fetcher/relative-dot-slash/inspec.yml | 11 +++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/unit/mock/profiles/git-fetcher/relative-dot-slash/controls/relative-dot-slash.rb create mode 100644 test/unit/mock/profiles/git-fetcher/relative-dot-slash/inspec.yml diff --git a/test/functional/git_fetcher_test.rb b/test/functional/git_fetcher_test.rb index 0bec45bee..044c8eebf 100644 --- a/test/functional/git_fetcher_test.rb +++ b/test/functional/git_fetcher_test.rb @@ -98,13 +98,22 @@ describe "running profiles with git-based dependencies" do end #------------ Edge Cases for Relative Path Support -------------------# + + # TODO: These next two tests trigger a bug, in which the profile appears + # to have a key collision in the cache. + describe "running a profile with an '' relative path dependency" do it "should find the top-level profile in the git-referenced child profile and execute that" do assert_relative_fetch_works("relative-empty", ["relative-empty", "basic-local"], ["relative-empty-01", "basic-local-01"]) end end - # describe "running a profile with an ./ relative path dependency" - # describe "running a profile with a relative path dependency that does not exist" + describe "running a profile with an ./ relative path dependency" do + it "should find the top-level profile in the git-referenced child profile and execute that" do + assert_relative_fetch_works("relative-dot-slash", ["relative-dot-slash", "basic-local"], ["relative-dot-slash-01", "basic-local-01"]) + end + end + + # describe "running a profile with a relative path dependency that does not exist" do end diff --git a/test/unit/mock/profiles/git-fetcher/relative-dot-slash/controls/relative-dot-slash.rb b/test/unit/mock/profiles/git-fetcher/relative-dot-slash/controls/relative-dot-slash.rb new file mode 100644 index 000000000..a893c2bf4 --- /dev/null +++ b/test/unit/mock/profiles/git-fetcher/relative-dot-slash/controls/relative-dot-slash.rb @@ -0,0 +1,7 @@ +include_controls 'basic-local' + +control 'relative-dot-slash-01' do + describe 'always-pass' do + it { should cmp 'always-pass'} + end +end \ No newline at end of file diff --git a/test/unit/mock/profiles/git-fetcher/relative-dot-slash/inspec.yml b/test/unit/mock/profiles/git-fetcher/relative-dot-slash/inspec.yml new file mode 100644 index 000000000..1dc08f6c0 --- /dev/null +++ b/test/unit/mock/profiles/git-fetcher/relative-dot-slash/inspec.yml @@ -0,0 +1,11 @@ +name: relative-dot-slash +title: relative-dot-slash +license: Apache-2.0 +summary: A profile that depends on profiles using an ./ path +version: 0.1.0 +supports: + platform: os +depends: +- name: basic-local + git: test/unit/mock/profiles/git-fetcher/basic-local + relative_path: ./