2022-03-15 18:40:47 +00:00
|
|
|
require "inspec/globals"
|
|
|
|
require "#{Inspec.src_root}/test/helper"
|
|
|
|
require_relative "../../../lib/inspec/resources/cgroup"
|
|
|
|
|
|
|
|
describe Inspec::Resources::Cgroup do
|
2022-03-23 03:10:34 +00:00
|
|
|
# ubuntu
|
|
|
|
it "check carrotking cgroup information on ubuntu" do
|
|
|
|
resource = MockLoader.new("ubuntu".to_sym).load_resource("cgroup", "carrotking")
|
|
|
|
_(resource.cpuset.cpus).must_equal 0
|
|
|
|
_(resource.memory.stat).must_match(/hierarchical_memory_limit 9223372036854771712/)
|
|
|
|
end
|
|
|
|
|
|
|
|
# debian
|
|
|
|
it "check carrotking cgroup information on debian" do
|
|
|
|
resource = MockLoader.new("debian8".to_sym).load_resource("cgroup", "carrotking")
|
|
|
|
_(resource.cpuset.cpus).must_equal 0
|
|
|
|
_(resource.memory.stat).must_match(/hierarchical_memory_limit 9223372036854771712/)
|
|
|
|
end
|
|
|
|
|
|
|
|
# windows
|
|
|
|
it "check carrotking cgroup information on windows" do
|
|
|
|
resource = MockLoader.new("windows".to_sym).load_resource("cgroup", "carrotking")
|
|
|
|
_(resource.resource_skipped?).must_equal true
|
|
|
|
_(resource.resource_exception_message).must_equal "The `cgroup` resource is not supported on your OS yet."
|
|
|
|
end
|
2022-03-15 18:40:47 +00:00
|
|
|
|
2022-03-23 03:10:34 +00:00
|
|
|
# undefined
|
|
|
|
it "check carrotking cgroup information on unsupported os" do
|
|
|
|
resource = MockLoader.new("undefined".to_sym).load_resource("cgroup", "carrotking")
|
|
|
|
_(resource.resource_skipped?).must_equal true
|
|
|
|
_(resource.resource_exception_message).must_equal "The `cgroup` resource is not supported on your OS yet."
|
2022-03-15 18:40:47 +00:00
|
|
|
end
|
|
|
|
end
|