Sha256: 775f9644642f046736cd35ca0e1933a4fe7641bbf726013251906b35b9d64de0

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

control "inspec-habitat-create" do
  title "Create command"

  output_hart_dir = "/home/vagrant/output"
  find_hart_output = command("find #{output_hart_dir} -name '*.hart'").stdout
  hart_files = find_hart_output.split("\n")

  hab_profile_path = "/home/vagrant/hab_test_profile"
  find_profile_files_command = "find #{hab_profile_path} -type f -printf '%f\n'"
  profile_files = command(find_profile_files_command).stdout.split("\n").sort
  expected_files = %w{
    .gitkeep
    README.md
    example.rb
    inspec.yml
  }

  describe "`inspec habitat profile create`" do
    it "should create exactly 1 hart file" do
      expect(hart_files.length).to eq(1)
    end
    it "does not add any extra files to a default generated profile" do
      expect(profile_files).to eq(expected_files)
    end
  end
end

control "inspec-habitat-service" do
  title "inspec-profile-hab_test_profile service"
  describe "The running service" do
    it "should create a log file" do
      log = "/hab/svc/inspec-profile-hab_test_profile/logs/inspec_log.txt"
      expect(file(log).exist?).to be(true)
    end
    it "should create a JSON file for the last run" do
      log = "/hab/svc/inspec-profile-hab_test_profile/logs/inspec_last_run.json"
      JSON.parse(file(log).content)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
inspec-4.18.51 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.18.39 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.18.38 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.18.24 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.18.0 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.17.17 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.17.15 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.17.14 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.17.11 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.17.7 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.16.0 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.12.0 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.10.4 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.7.24 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.7.18 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.7.3 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.6.9 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.6.4 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb
inspec-4.6.3 lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb