2019-06-11 22:24:35 +00:00
|
|
|
require "functional/helper"
|
|
|
|
require "fileutils"
|
|
|
|
require "tmpdir"
|
|
|
|
require "yaml"
|
2016-09-08 09:11:44 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "profiles with git-based dependencies" do
|
2016-09-08 09:11:44 +00:00
|
|
|
include FunctionalHelper
|
|
|
|
before(:all) do
|
2019-06-04 06:08:14 +00:00
|
|
|
skip_windows!
|
|
|
|
|
2016-09-08 09:11:44 +00:00
|
|
|
@tmpdir = Dir.mktmpdir
|
|
|
|
@profile_dir = File.join(@tmpdir, "test-profile")
|
|
|
|
@git_dep_dir = File.join(@tmpdir, "git-dep")
|
|
|
|
|
|
|
|
Dir.chdir(@tmpdir) do
|
|
|
|
inspec("init profile git-dep")
|
|
|
|
inspec("init profile test-profile")
|
|
|
|
end
|
|
|
|
|
|
|
|
Dir.chdir(@git_dep_dir) do
|
|
|
|
CMD.run_command("git init")
|
|
|
|
CMD.run_command("git add .")
|
2018-11-08 17:00:14 +00:00
|
|
|
CMD.run_command("git config user.name \"test\"")
|
|
|
|
CMD.run_command("git config user.email \"test@yahoo.com\"")
|
|
|
|
CMD.run_command("git commit -m \"initial commit\" --no-gpg-sign")
|
|
|
|
CMD.run_command("git commit -m \"another commit\" --allow-empty --no-gpg-sign")
|
2016-09-08 09:11:44 +00:00
|
|
|
CMD.run_command("git tag antag")
|
|
|
|
end
|
|
|
|
|
2018-10-25 18:16:31 +00:00
|
|
|
inspec_yml = YAML.load(File.read(File.join(@profile_dir, "inspec.yml")))
|
|
|
|
inspec_yml["depends"] = [
|
|
|
|
{
|
2019-06-11 22:24:35 +00:00
|
|
|
"name" => "git-dep",
|
|
|
|
"git" => @git_dep_dir,
|
|
|
|
"tag" => "antag",
|
2019-07-09 00:20:30 +00:00
|
|
|
},
|
2018-10-25 18:16:31 +00:00
|
|
|
]
|
|
|
|
File.write(File.join(@profile_dir, "inspec.yml"), YAML.dump(inspec_yml))
|
2016-09-08 09:11:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
after(:all) do
|
|
|
|
FileUtils.rm_rf(@tmpdir)
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "executes a profile with a git based dependency" do
|
2016-09-21 21:22:53 +00:00
|
|
|
out = inspec("exec #{@profile_dir} --no-create-lockfile")
|
2019-06-11 22:24:35 +00:00
|
|
|
out.stderr.must_equal ""
|
2016-09-08 09:11:44 +00:00
|
|
|
out.exit_status.must_equal 0
|
|
|
|
end
|
|
|
|
end
|