mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
0e9e249506
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
42 lines
No EOL
1.7 KiB
Ruby
42 lines
No EOL
1.7 KiB
Ruby
# Load (require) the InSpec globals definition file.
|
|
require "inspec/globals"
|
|
# Load (require) the core test unit helper file
|
|
require "#{Inspec.src_root}/test/helper"
|
|
# Load (require) the resource library file
|
|
require_relative "../../../lib/inspec/resources/lxc"
|
|
|
|
describe "Inspec::Resources::Lxc" do
|
|
# ubuntu
|
|
it "verify lxc resource on ubuntu" do
|
|
resource = MockLoader.new(:ubuntu).load_resource("lxc", "my-ubuntu-container")
|
|
_(resource.exists?).must_equal true
|
|
_(resource.running?).must_equal true
|
|
_(resource.resource_skipped?).must_equal false
|
|
_(resource.resource_id).must_equal "my-ubuntu-container"
|
|
end
|
|
|
|
# # ubuntu
|
|
it "verify lxc resource on ubuntu for non exisiting container" do
|
|
resource = MockLoader.new(:ubuntu).load_resource("lxc", "my-ubuntu-container-1")
|
|
_(resource.exists?).must_equal false
|
|
_(resource.running?).must_equal false
|
|
_(resource.resource_skipped?).must_equal false
|
|
_(resource.resource_id).must_equal "my-ubuntu-container-1"
|
|
end
|
|
|
|
# windows
|
|
it "verify lxc resource on windows" do
|
|
resource = MockLoader.new(:windows).load_resource("lxc", "my-ubuntu-container")
|
|
_(resource.resource_skipped?).must_equal true
|
|
_(resource.resource_exception_message).must_equal "The `lxc` resource is not supported on your OS yet."
|
|
_(resource.resource_id).must_equal "my-ubuntu-container"
|
|
end
|
|
|
|
# undefined
|
|
it "verify lxc resource on unsupported os" do
|
|
resource = MockLoader.new(:undefined).load_resource("lxc", "my-ubuntu-container")
|
|
_(resource.resource_skipped?).must_equal true
|
|
_(resource.resource_exception_message).must_equal "The `lxc` resource is not supported on your OS yet."
|
|
_(resource.resource_id).must_equal "my-ubuntu-container"
|
|
end
|
|
end |