Skip to content

Commit 4607e81

Browse files
authored
Merge pull request #311 from ThoughtCrhyme/MODULES-6582
(MODULES-6582) Add ability to test against sql server 2017
2 parents ee247ce + b99f957 commit 4607e81

4 files changed

+25
-5
lines changed

spec/acceptance/sqlserver_instance_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def sql_query_is_user_sysadmin(username)
123123
ensure_sqlserver_instance(features, inst_name, 'absent')
124124
end
125125

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

129129
validate_sql_install(host, {:version => version}) do |r|

spec/acceptance/z_last_sqlserver_features_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def ensure_sql_features(features, ensure_val = 'present')
121121
end
122122
end
123123

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

128128
validate_sql_install(host, {:version => sql_version}) do |r|

spec/spec_helper_acceptance.rb

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
WIN_2012R2_ISO = "en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso"
1313
QA_RESOURCE_ROOT = "https://artifactory.delivery.puppetlabs.net/artifactory/generic__iso/iso/SQLServer"
1414
SQL_2019_ISO = "SQLServer2019CTP2.4-x64-ENU.iso"
15+
SQL_2017_ISO = "SQLServer2017-x64-ENU.iso"
1516
SQL_2016_ISO = "en_sql_server_2016_enterprise_with_service_pack_1_x64_dvd_9542382.iso"
1617
SQL_2014_ISO = "SQLServer2014SP3-FullSlipstream-x64-ENU.iso"
1718
SQL_2012_ISO = "SQLServer2012SP1-FullSlipstream-ENU-x64.iso"
@@ -24,6 +25,12 @@
2425
c.before(:suite) do
2526
host = find_only_one('sql_host')
2627
base_install(host['sql_version'])
28+
#Verify that the version in the host config file is indeed the version on the machine
29+
execute_powershell_script_on(host, 'Invoke-Sqlcmd -Query "SELECT @@VERSION;" -QueryTimeout 3') do |result|
30+
if(!result.stdout.include?(host[:sql_version].to_s))
31+
raise "Version in host config #{host[:sql_version]} does not match SQL version #{result}"
32+
end
33+
end
2734
end
2835
end
2936

spec/sql_testing_helpers.rb

+15-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def run_sql_query(host, opts = {}, &block)
5656
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\"
5757
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\120\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\"
5858
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\"
59+
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\140\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\140\\Tools\\Binn\\"
5960
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\150\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\"
61+
$Env:Path +=\";C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn;C:\\Program Files\\Microsoft SQL Server\\170\\Tools\\Binn\\"
6062
sqlcmd.exe -S #{server}\\#{instance} -U #{sql_admin_user} -P #{sql_admin_pass} -Q \"#{query}\"
6163
EOS
6264
# sqlcmd has problem authenticate to sqlserver if the instance is the default one MSSQLSERVER
@@ -104,6 +106,12 @@ def base_install(sql_version)
104106
:file => SQL_2016_ISO,
105107
:drive_letter => 'H'
106108
}
109+
when 2017
110+
iso_opts = {
111+
:folder => QA_RESOURCE_ROOT,
112+
:file => SQL_2017_ISO,
113+
:drive_letter => 'H'
114+
}
107115
when 2019
108116
iso_opts = {
109117
:folder => QA_RESOURCE_ROOT,
@@ -153,12 +161,17 @@ def remove_sql_instances(host, opts = {})
153161
end
154162

155163
def get_install_paths(version)
156-
vers = { '2012' => '110', '2014' => '120', '2016' => '130', '2019' => '150' }
164+
vers = { '2012' => '110', '2014' => '120', '2016' => '130', '2017' => '140', '2019' => '150' }
157165

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

160168
dir = "%ProgramFiles%\\Microsoft SQL Server\\#{vers[version]}\\Setup Bootstrap"
161-
[dir, "#{dir}\\SQLServer#{version}"]
169+
sql_directory = "SQL"
170+
if version != "2017"
171+
sql_directory = sql_directory + "Server"
172+
end
173+
174+
[dir, "#{dir}\\#{sql_directory}#{version}"]
162175
end
163176

164177
def install_pe_license(host)

0 commit comments

Comments
 (0)