Skip to content

(MODULES-6582) Add ability to test against sql server 2017 #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/acceptance/sqlserver_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def sql_query_is_user_sysadmin(username)
ensure_sqlserver_instance(features, inst_name, 'absent')
end

it "create #{inst_name} instance with only one RS feature", :tier_high => true do
it "create #{inst_name} instance with only one RS feature", :unless => version.to_i >= 2017, :tier_high => true do
ensure_sqlserver_instance(features, inst_name)

validate_sql_install(host, {:version => version}) do |r|
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/z_last_sqlserver_features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def ensure_sql_features(features, ensure_val = 'present')
end
end

# TODO: Guard on SQL 2016
it "'ADV_SSMS'", :unless => sql_version == '2016', :tier_low => true do
# TODO: Guard on SQL 2016 and 2017
it "'ADV_SSMS'", :unless => sql_version.to_i >= 2016, :tier_low => true do
ensure_sql_features(features - ['ADV_SSMS'])

validate_sql_install(host, {:version => sql_version}) do |r|
Expand Down
7 changes: 7 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
WIN_2012R2_ISO = "en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso"
QA_RESOURCE_ROOT = "https://artifactory.delivery.puppetlabs.net/artifactory/generic__iso/iso/SQLServer"
SQL_2019_ISO = "SQLServer2019CTP2.4-x64-ENU.iso"
SQL_2017_ISO = "SQLServer2017-x64-ENU.iso"
SQL_2016_ISO = "en_sql_server_2016_enterprise_with_service_pack_1_x64_dvd_9542382.iso"
SQL_2014_ISO = "SQLServer2014SP3-FullSlipstream-x64-ENU.iso"
SQL_2012_ISO = "SQLServer2012SP1-FullSlipstream-ENU-x64.iso"
Expand All @@ -24,6 +25,12 @@
c.before(:suite) do
host = find_only_one('sql_host')
base_install(host['sql_version'])
#Verify that the version in the host config file is indeed the version on the machine
execute_powershell_script_on(host, 'Invoke-Sqlcmd -Query "SELECT @@VERSION;" -QueryTimeout 3') do |result|
if(!result.stdout.include?(host[:sql_version].to_s))
raise "Version in host config #{host[:sql_version]} does not match SQL version #{result}"
end
end
end
end

Expand Down
17 changes: 15 additions & 2 deletions spec/sql_testing_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def run_sql_query(host, opts = {}, &block)
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\"
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\120\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\"
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\"
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\140\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\140\\Tools\\Binn\\"
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\150\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\"
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\170\\Tools\\Binn\\"
sqlcmd.exe -S #{server}\\#{instance} -U #{sql_admin_user} -P #{sql_admin_pass} -Q \"#{query}\"
EOS
# sqlcmd has problem authenticate to sqlserver if the instance is the default one MSSQLSERVER
Expand Down Expand Up @@ -104,6 +106,12 @@ def base_install(sql_version)
:file => SQL_2016_ISO,
:drive_letter => 'H'
}
when 2017
iso_opts = {
:folder => QA_RESOURCE_ROOT,
:file => SQL_2017_ISO,
:drive_letter => 'H'
}
when 2019
iso_opts = {
:folder => QA_RESOURCE_ROOT,
Expand Down Expand Up @@ -153,12 +161,17 @@ def remove_sql_instances(host, opts = {})
end

def get_install_paths(version)
vers = { '2012' => '110', '2014' => '120', '2016' => '130', '2019' => '150' }
vers = { '2012' => '110', '2014' => '120', '2016' => '130', '2017' => '140', '2019' => '150' }

raise 'Valid version must be specified' if ! vers.keys.include?(version)

dir = "%ProgramFiles%\\Microsoft SQL Server\\#{vers[version]}\\Setup Bootstrap"
[dir, "#{dir}\\SQLServer#{version}"]
sql_directory = "SQL"
if version != "2017"
sql_directory = sql_directory + "Server"
end

[dir, "#{dir}\\#{sql_directory}#{version}"]
end

def install_pe_license(host)
Expand Down