mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
Merge pull request #5584 from inspec/nm/mssql-port-fix
Remove default port for mssql_session, allowing named connections
This commit is contained in:
commit
f22c342704
2 changed files with 2 additions and 9 deletions
|
@ -42,11 +42,7 @@ module Inspec::Resources
|
|||
@local_mode = opts[:local_mode]
|
||||
unless local_mode?
|
||||
@host = opts[:host] || "localhost"
|
||||
if opts.key?(:port)
|
||||
@port = opts[:port]
|
||||
else
|
||||
@port = "1433"
|
||||
end
|
||||
@port = opts[:port]
|
||||
end
|
||||
@instance = opts[:instance]
|
||||
@db_name = opts[:db_name]
|
||||
|
|
|
@ -8,7 +8,6 @@ describe "Inspec::Resources::MssqlSession" do
|
|||
_(resource.user).must_equal "sa"
|
||||
_(resource.password).must_equal "yourStrong(!)Password"
|
||||
_(resource.host).must_equal "localhost"
|
||||
_(resource.port).must_equal "1433"
|
||||
end
|
||||
|
||||
it "verify mssql_session configuration with custom hostname" do
|
||||
|
@ -16,7 +15,6 @@ describe "Inspec::Resources::MssqlSession" do
|
|||
_(resource.user).must_equal "sa"
|
||||
_(resource.password).must_equal "yourStrong(!)Password"
|
||||
_(resource.host).must_equal "inspec.domain.tld"
|
||||
_(resource.port).must_equal "1433"
|
||||
end
|
||||
|
||||
it "verify mssql_session configuration with custom instance" do
|
||||
|
@ -24,7 +22,6 @@ describe "Inspec::Resources::MssqlSession" do
|
|||
_(resource.user).must_equal "sa"
|
||||
_(resource.password).must_equal "yourStrong(!)Password"
|
||||
_(resource.host).must_equal "localhost"
|
||||
_(resource.port).must_equal "1433"
|
||||
_(resource.instance).must_equal "SQL2012INSPEC"
|
||||
end
|
||||
|
||||
|
@ -63,7 +60,7 @@ describe "Inspec::Resources::MssqlSession" do
|
|||
end
|
||||
|
||||
it "run a SQL query" do
|
||||
resource = load_resource("mssql_session", user: "sa", password: "yourStrong(!)Password", host: "localhost")
|
||||
resource = load_resource("mssql_session", user: "sa", password: "yourStrong(!)Password", host: "localhost", port: "1433")
|
||||
query = resource.query("SELECT SERVERPROPERTY('ProductVersion') as result")
|
||||
_(query.size).must_equal 1
|
||||
_(query.row(0).column("result").value).must_equal "14.0.600.250"
|
||||
|
|
Loading…
Reference in a new issue