7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
##2015-08-24 - 1.1.0
##Supported Release 1.1.1
###Summary

Small release for support of newer PE versions.

##2015-09-08 - Supported Release 1.1.0
###Summary

User, Roles and Login as well as they permissions associated with each are now available.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Microsoft SQL Server is a database platform for Windows. The sqlserver module le
The sqlserver module requires the following:

* Puppet Enterprise 3.7 or later.
* The Puppet Supported [`acl` module](https://forge.puppetlabs.com/puppetlabs/acl).
* .NET 3.5 (installed automatically if not present. This might require an internet connection).
* The contents of the SQL Server ISO file, mounted or extracted either locally or on a network share.
* Windows Server 2012 or 2012R2.
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-sqlserver",
"version": "1.1.0",
"version": "1.1.1",
"author": "puppetlabs",
"summary": "The `sqlserver` module installs and manages MS SQL Server 2012 and 2014 on Windows systems.",
"license": "PuppetLabs-Enterprise",
Expand Down Expand Up @@ -29,7 +29,7 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.7.0 < 2015.3.0"
"version_requirement": ">= 3.7.0 < 2015.4.0"
}
],
"dependencies": [
Expand Down
70 changes: 19 additions & 51 deletions spec/acceptance/sqlserver_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
host = find_only_one("sql_host")

# Get instance name
INST_NAME = ("MSSQL" + SecureRandom.hex(4)).upcase
inst_name = ("MSSQL" + SecureRandom.hex(4)).upcase

# Get database name
DB_NAME = ("DB" + SecureRandom.hex(4)).upcase
db_name = ("DB" + SecureRandom.hex(4)).upcase

describe "sqlserver::config test", :node => host do
version = host['sql_version'].to_s

def ensure_sqlserver_instance(host, ensure_val = 'present')
def ensure_sqlserver_instance(host,inst_name, ensure_val = 'present')
create_new_instance= <<-MANIFEST
sqlserver_instance{'#{INST_NAME}':
sqlserver_instance{'#{inst_name}':
ensure => '#{ensure_val}',
source => 'H:',
features => [ 'SQL' ],
Expand All @@ -30,11 +29,11 @@ def ensure_sqlserver_instance(host, ensure_val = 'present')
end
end

context "can create sqlserver::config" do
context "Testing sqlserver::config", {:testrail => ['89070', '89071', '89072', '89073']} do

before(:all) do
# Create new instance
ensure_sqlserver_instance(host)
ensure_sqlserver_instance(host, inst_name)

# get credentials for new config
@admin_user = "admin" + SecureRandom.hex(2)
Expand All @@ -51,13 +50,13 @@ def ensure_sqlserver_instance(host, ensure_val = 'present')

it "Create New Admin Login:" do
create_new_login = <<-MANIFEST
sqlserver::config{'#{INST_NAME}':
instance_name => '#{INST_NAME}',
sqlserver::config{'#{inst_name}':
instance_name => '#{inst_name}',
admin_user => 'sa',
admin_pass => 'Pupp3t1@',
}
sqlserver::login{'#{@admin_user}':
instance => '#{INST_NAME}',
instance => '#{inst_name}',
login_type => 'SQL_LOGIN',
login => '#{@admin_user}',
password => '#{@admin_pass}',
Expand All @@ -71,13 +70,13 @@ def ensure_sqlserver_instance(host, ensure_val = 'present')

it "Validate New Config WITH using instance_name in sqlserver::config" do
pp = <<-MANIFEST
sqlserver::config{'#{INST_NAME}':
sqlserver::config{'#{inst_name}':
admin_user => '#{@admin_user}',
admin_pass => '#{@admin_pass}',
instance_name => '#{INST_NAME}',
instance_name => '#{inst_name}',
}
sqlserver::database{'#{DB_NAME}':
instance => '#{INST_NAME}',
sqlserver::database{'#{db_name}':
instance => '#{inst_name}',
}
MANIFEST
apply_manifest_on(host, pp) do |r|
Expand All @@ -87,56 +86,25 @@ def ensure_sqlserver_instance(host, ensure_val = 'present')

it "Validate new login and database actualy created" do
hostname = host.hostname
query = "USE #{DB_NAME};"
query = "USE #{db_name}; SELECT * from master..sysdatabases WHERE name = '#{db_name}'"

output = run_sql_query(host, {:query => query, :server => hostname, :instance => INST_NAME, :sql_admin_user => @admin_user, :sql_admin_pass => @admin_pass})
expect(output).to match(/Changed database context to '#{Regexp.new(DB_NAME)}'/)
run_sql_query(host, {:query => query, :server => hostname, :instance => inst_name, \
:sql_admin_user => @admin_user, :sql_admin_pass => @admin_pass, :expected_row_count => 1})
end

it "Validate New Config WITHOUT using instance_name in sqlserver::config" do
pp = <<-MANIFEST
sqlserver::config{'#{INST_NAME}':
sqlserver::config{'#{inst_name}':
admin_user => '#{@admin_user}',
admin_pass => '#{@admin_pass}',
}
sqlserver::database{'#{DB_NAME}':
instance => '#{INST_NAME}',
sqlserver::database{'#{db_name}':
instance => '#{inst_name}',
}
MANIFEST
apply_manifest_on(host, pp) do |r|
expect(r.stderr).not_to match(/Error/i)
end
end

it "Negative test: sqlserver::config without admin_user" do
pp = <<-MANIFEST
sqlserver::config{'#{INST_NAME}':
admin_pass => '#{@admin_pass}',
instance_name => '#{INST_NAME}',
}
sqlserver::database{'#{DB_NAME}':
instance => '#{INST_NAME}',
}
MANIFEST
apply_manifest_on(host, pp, {:acceptable_exit_codes => [0,1]}) do |r|
expect(r.stderr).to match(/Error: Must pass admin_user to Sqlserver/)

end
end

it "Negative test: sqlserver::config without admin_pass" do
pp = <<-MANIFEST
sqlserver::config{'#{INST_NAME}':
admin_user => '#{@admin_user}',
instance_name => '#{INST_NAME}',
}
sqlserver::database{'#{DB_NAME}':
instance => '#{INST_NAME}',
}
MANIFEST
apply_manifest_on(host, pp, {:acceptable_exit_codes => [0,1]}) do |r|
expect(r.stderr).to match(/Error: Must pass admin_pass to Sqlserver/)
end
end
end
end
Loading