inspec/test/unit/resources/ibmdb2_conf_test.rb
Vasu1105 10d96ece3f Add windows platform support for ibmdb2_conf and ibmdb2_session resource
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-01 18:06:16 +05:30

35 lines
1.6 KiB
Ruby

require "helper"
require "inspec/resource"
require "inspec/resources/ibmdb2_conf"
describe "Inspec::Resources::ibmdb2_conf" do
it "fails when no IBM db2 executable path is provided" do
resource = load_resource("ibmdb2_conf", db_instance: "db2inst1")
_(resource.resource_failed?).must_equal true
_(resource.resource_exception_message).must_equal "Can't connect to IBM DB2 without db2_executable_file_path, db_instance options provided."
end
it "fails when no IBM db2 instance name is provided" do
resource = load_resource("ibmdb2_conf", db2_executable_file_path: "/opt/ibm/db2/V11.5/bin/db2")
_(resource.resource_failed?).must_equal true
_(resource.resource_exception_message).must_equal "Can't connect to IBM DB2 without db2_executable_file_path, db_instance options provided."
end
it "verify ibmdb2_conf on windows" do
resource = MockLoader.new(:windows).load_resource("ibmdb2_conf")
_(resource.resource_failed?).must_equal false
_(resource.output).must_be_kind_of Array
end
it "return the output in array format" do
resource = load_resource("ibmdb2_conf", db2_executable_file_path: "/opt/ibm/db2/V11.5/bin/db2", db_instance: "db2inst1")
_(resource.resource_failed?).must_equal false
_(resource.output).must_be_kind_of Array
end
it "returns expected result" do
resource = load_resource("ibmdb2_conf", db2_executable_file_path: "/opt/ibm/db2/V11.5/bin/db2", db_instance: "db2inst1")
_(resource.resource_failed?).must_equal false
_(resource.output).must_include "Audit buffer size (4KB) (AUDIT_BUF_SZ) = 0"
end
end