summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-12-01 12:37:35 -0800
committerPete Higgins <pete@peterhiggins.org>2020-12-01 16:12:04 -0800
commitaad6f9d85851ad5f76ab8e5ed457858dc7416982 (patch)
tree1e783eba15e474a482cf55b230eeb3aa8b845ad6 /spec
parent3615e74f34bb872dadad72aeb0644569b32ed640 (diff)
downloadchef-aad6f9d85851ad5f76ab8e5ed457858dc7416982.tar.gz
Rename audit mode to Compliance Phase.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/compliance/compliance_spec.rb (renamed from spec/integration/audit/audit_spec.rb)0
-rw-r--r--spec/unit/client_spec.rb2
-rw-r--r--spec/unit/compliance/fetcher/automate_spec.rb (renamed from spec/unit/audit/fetcher/automate_spec.rb)46
-rw-r--r--spec/unit/compliance/fetcher/chef_server_spec.rb (renamed from spec/unit/audit/fetcher/chef_server_spec.rb)32
-rw-r--r--spec/unit/compliance/reporter/automate_spec.rb (renamed from spec/unit/audit/reporter/automate_spec.rb)6
-rw-r--r--spec/unit/compliance/reporter/chef_server_automate_spec.rb (renamed from spec/unit/audit/reporter/chef_server_automate_spec.rb)4
-rw-r--r--spec/unit/compliance/reporter/compliance_enforcer_spec.rb (renamed from spec/unit/audit/reporter/audit_enforcer_spec.rb)6
-rw-r--r--spec/unit/compliance/runner_spec.rb (renamed from spec/unit/audit/runner_spec.rb)2
8 files changed, 49 insertions, 49 deletions
diff --git a/spec/integration/audit/audit_spec.rb b/spec/integration/compliance/compliance_spec.rb
index 98776308de..98776308de 100644
--- a/spec/integration/audit/audit_spec.rb
+++ b/spec/integration/compliance/compliance_spec.rb
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index fc52e8fec4..b6a321c8e8 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -129,7 +129,7 @@ shared_context "a client run" do
expect(client.events).to receive(:register).with(instance_of(Chef::DataCollector::Reporter))
expect(client.events).to receive(:register).with(instance_of(Chef::ResourceReporter))
expect(client.events).to receive(:register).with(instance_of(Chef::ActionCollection))
- expect(client.events).to receive(:register).with(instance_of(Chef::Audit::Runner))
+ expect(client.events).to receive(:register).with(instance_of(Chef::Compliance::Runner))
end
def stub_for_node_load
diff --git a/spec/unit/audit/fetcher/automate_spec.rb b/spec/unit/compliance/fetcher/automate_spec.rb
index b4ed3f4f8c..bc2125aaa7 100644
--- a/spec/unit/audit/fetcher/automate_spec.rb
+++ b/spec/unit/compliance/fetcher/automate_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-require "chef/audit/fetcher/automate"
+require "chef/compliance/fetcher/automate"
-describe Chef::Audit::Fetcher::Automate do
+describe Chef::Compliance::Fetcher::Automate do
describe ".resolve" do
before do
Chef::Config[:data_collector] = {
@@ -14,9 +14,9 @@ describe Chef::Audit::Fetcher::Automate do
context "when target is a string" do
it "should resolve a compliance URL" do
- res = Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
@@ -25,25 +25,25 @@ describe Chef::Audit::Fetcher::Automate do
Chef::Config[:data_collector].delete(:token)
expect {
- Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
}.to raise_error(/No data-collector token set/)
end
it "includes the data collector token" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://automate.test/compliance/profiles/namespace/profile_name/tar",
hash_including("token" => token)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-compliance URL" do
- res = Chef::Audit::Fetcher::Automate.resolve("http://github.com/chef-cookbooks/audit")
+ res = Chef::Compliance::Fetcher::Automate.resolve("http://github.com/chef-cookbooks/audit")
expect(res).to eq(nil)
end
@@ -51,51 +51,51 @@ describe Chef::Audit::Fetcher::Automate do
context "when target is a hash" do
it "should resolve a target with a version" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/version/1.2.3/tar"
expect(res.target).to eq(expected)
end
it "should resolve a target without a version" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "uses url key when present" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3",
url: "https://profile.server.test/profiles/profile_name/1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://profile.server.test/profiles/profile_name/1.2.3"
expect(res.target).to eq(expected)
end
it "does not include token in the config when url key is present" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://profile.server.test/profiles/profile_name/1.2.3",
hash_including("token" => nil)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3",
url: "https://profile.server.test/profiles/profile_name/1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://profile.server.test/profiles/profile_name/1.2.3"
expect(res.target).to eq(expected)
end
@@ -104,25 +104,25 @@ describe Chef::Audit::Fetcher::Automate do
Chef::Config[:data_collector].delete(:token)
expect {
- Chef::Audit::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
+ Chef::Compliance::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
}.to raise_error(Inspec::FetcherFailure, /No data-collector token set/)
end
it "includes the data collector token" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://automate.test/compliance/profiles/namespace/profile_name/tar",
hash_including("token" => token)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-profile Hash" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
profile: "namespace/profile_name",
version: "1.2.3"
)
diff --git a/spec/unit/audit/fetcher/chef_server_spec.rb b/spec/unit/compliance/fetcher/chef_server_spec.rb
index dd00efd567..fc1c229989 100644
--- a/spec/unit/audit/fetcher/chef_server_spec.rb
+++ b/spec/unit/compliance/fetcher/chef_server_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-require "chef/audit/fetcher/chef_server"
+require "chef/compliance/fetcher/chef_server"
-describe Chef::Audit::Fetcher::ChefServer do
+describe Chef::Compliance::Fetcher::ChefServer do
let(:node) do
Chef::Node.new.tap do |n|
n.default["audit"] = {}
@@ -17,32 +17,32 @@ describe Chef::Audit::Fetcher::ChefServer do
describe ".resolve" do
context "when target is a string" do
it "should resolve a compliance URL" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "should add /compliance URL prefix if needed" do
node.default["audit"]["fetcher"] = "chef-server"
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/compliance/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "includes user in the URL if present" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://username@namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://username@namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/username@namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-compliance URL" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("http://github.com/chef-cookbooks/audit")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("http://github.com/chef-cookbooks/audit")
expect(res).to eq(nil)
end
@@ -50,38 +50,38 @@ describe Chef::Audit::Fetcher::ChefServer do
context "when target is a hash" do
it "should resolve a target with a version" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "namespace/profile_name",
version: "1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/version/1.2.3/tar"
expect(res.target).to eq(expected)
end
it "should resolve a target without a version" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "includes user in the URL if present" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "username@namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/username@namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-profile Hash" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
profile: "namespace/profile_name",
version: "1.2.3"
)
diff --git a/spec/unit/audit/reporter/automate_spec.rb b/spec/unit/compliance/reporter/automate_spec.rb
index d55bea282f..e0a33892b0 100644
--- a/spec/unit/audit/reporter/automate_spec.rb
+++ b/spec/unit/compliance/reporter/automate_spec.rb
@@ -1,8 +1,8 @@
require "spec_helper"
require "json" # For .to_json
-describe Chef::Audit::Reporter::Automate do
- let(:reporter) { Chef::Audit::Reporter::Automate.new(opts) }
+describe Chef::Compliance::Reporter::Automate do
+ let(:reporter) { Chef::Compliance::Reporter::Automate.new(opts) }
let(:opts) do
{
@@ -267,7 +267,7 @@ describe Chef::Audit::Reporter::Automate do
it "does not send report when entity_uuid is missing" do
opts.delete(:entity_uuid)
- reporter = Chef::Audit::Reporter::Automate.new(opts)
+ reporter = Chef::Compliance::Reporter::Automate.new(opts)
expect(reporter.send_report(inspec_report)).to eq(false)
end
end
diff --git a/spec/unit/audit/reporter/chef_server_automate_spec.rb b/spec/unit/compliance/reporter/chef_server_automate_spec.rb
index 46dacd812d..e45a7157ee 100644
--- a/spec/unit/audit/reporter/chef_server_automate_spec.rb
+++ b/spec/unit/compliance/reporter/chef_server_automate_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe Chef::Audit::Reporter::ChefServerAutomate do
+describe Chef::Compliance::Reporter::ChefServerAutomate do
before do
WebMock.disable_net_connect!
@@ -8,7 +8,7 @@ describe Chef::Audit::Reporter::ChefServerAutomate do
Chef::Config[:node_name] = "spec-node"
end
- let(:reporter) { Chef::Audit::Reporter::ChefServerAutomate.new(opts) }
+ let(:reporter) { Chef::Compliance::Reporter::ChefServerAutomate.new(opts) }
let(:opts) do
{
diff --git a/spec/unit/audit/reporter/audit_enforcer_spec.rb b/spec/unit/compliance/reporter/compliance_enforcer_spec.rb
index c29cb4a946..ae63cf0853 100644
--- a/spec/unit/audit/reporter/audit_enforcer_spec.rb
+++ b/spec/unit/compliance/reporter/compliance_enforcer_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-describe Chef::Audit::Reporter::AuditEnforcer do
- let(:reporter) { Chef::Audit::Reporter::AuditEnforcer.new }
+describe Chef::Compliance::Reporter::AuditEnforcer do
+ let(:reporter) { Chef::Compliance::Reporter::AuditEnforcer.new }
it "does not raise error for a successful InSpec report" do
report = {
@@ -43,6 +43,6 @@ describe Chef::Audit::Reporter::AuditEnforcer do
expect {
reporter.send_report(report)
- }.to raise_error(Chef::Audit::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
+ }.to raise_error(Chef::Compliance::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
end
end
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/compliance/runner_spec.rb
index 7e62ffa398..68c8a9553b 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/compliance/runner_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe Chef::Audit::Runner do
+describe Chef::Compliance::Runner do
let(:logger) { double(:logger).as_null_object }
let(:node) { Chef::Node.new(logger: logger) }