Skip to content

Commit a1cf183

Browse files
committed
(FM-2445) Features tests without instances installed
- Previously, tests relied on the assumption that SQL Server instances were installed already. Add a new test that verifies all shared features can be installed through a manifest, even with no SQL instances installed.
1 parent 4c6b994 commit a1cf183

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

spec/acceptance/sqlserver_features_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,36 @@ def bind_and_apply_failing_manifest(host, features, ensure_val = 'present')
233233
ensure_sql_features(host, features)
234234
end
235235
end
236+
237+
context 'with no installed instances' do
238+
239+
context 'can install' do
240+
241+
features = ['Tools', 'BC', 'Conn', 'SSMS', 'ADV_SSMS', 'SDK', 'IS', 'MDS']
242+
243+
before(:all) do
244+
# this assumes that only default MSSQLSERVER has been installed so far
245+
# be careful about running tests out of sequence
246+
remove_sql_instances(host, {:version => version, :instance_names => ['MSSQLSERVER']})
247+
end
248+
249+
after(:all) do
250+
remove_sql_features(host, {:features => features, :version => version})
251+
end
252+
253+
it 'all possible features' do
254+
ensure_sql_features(host, features)
255+
256+
validate_sql_install(host, {:version => version}) do |r|
257+
expect(r.stdout).to match(/Management Tools - Basic/)
258+
expect(r.stdout).to match(/Management Tools - Complete/)
259+
expect(r.stdout).to match(/Client Tools Connectivity/)
260+
expect(r.stdout).to match(/Client Tools Backwards Compatibility/)
261+
expect(r.stdout).to match(/Client Tools SDK/)
262+
expect(r.stdout).to match(/Integration Services/)
263+
expect(r.stdout).to match(/Master Data Services/)
264+
end
265+
end
266+
end
267+
end
236268
end

spec/sql_testing_helpers.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ def remove_sql_features(host, opts = {})
123123
on(host, "cmd.exe /c \"#{cmd}\"", {:acceptable_exit_codes => [0, 1, 2]})
124124
end
125125

126+
def remove_sql_instances(host, opts = {})
127+
bootstrap_dir, setup_dir = get_install_paths(opts[:version])
128+
opts[:instance_names].each do |instance_name|
129+
cmd = "cd \\\"#{setup_dir}\\\" && setup.exe /Action=uninstall /Q /IACCEPTSQLSERVERLICENSETERMS /FEATURES=SQL,AS,RS /INSTANCENAME=#{instance_name}"
130+
on(host, "cmd.exe /c \"#{cmd}\"", {:acceptable_exit_codes => [0]})
131+
end
132+
end
133+
126134
def get_install_paths(version)
127135
vers = { '2012' => '110', '2014' => '120' }
128136

0 commit comments

Comments
 (0)