Skip to content

Commit ac6315f

Browse files
committed
CAT-1208 : Fix CI to failures
1 parent 0942c3f commit ac6315f

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

spec/acceptance/sqlserver_config_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ def ensure_sqlserver_instance(inst_name, ensure_val = 'present')
2121
security_mode => 'SQL',
2222
sa_pwd => 'Pupp3t1@',
2323
windows_feature_source => 'I:\\sources\\sxs',
24+
install_switches => {
25+
'SkipInstallerRunCheck' => 'True',
26+
},
2427
}
2528
MANIFEST
26-
apply_manifest(pp, catch_failures: true)
29+
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
30+
apply_manifest(pp, catch_failures: true)
31+
end
2732
end
2833

2934
context 'Testing sqlserver::config' do

spec/spec_helper_acceptance_local.rb

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ class Helper
2121
SQL_ADMIN_PASS = 'Pupp3t1@'
2222
USER = Helper.instance.run_shell('$env:UserName').stdout.chomp
2323

24+
def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, error_matcher = nil)
25+
try = 0
26+
begin
27+
try += 1
28+
yield
29+
rescue StandardError => e
30+
raise unless try < max_retry_count && (error_matcher.nil? || e.message =~ error_matcher)
31+
32+
sleep retry_wait_interval_secs
33+
retry
34+
end
35+
end
36+
2437
RSpec.configure do |c|
2538
c.before(:suite) do
2639
Helper.instance.run_shell('puppet module install puppetlabs-mount_iso')
@@ -81,7 +94,9 @@ def mount_iso(opts = {})
8194
drive_letter => '#{drive_letter}',
8295
}
8396
MANIFEST
84-
Helper.instance.apply_manifest(pp)
97+
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
98+
Helper.instance.apply_manifest(pp)
99+
end
85100
end
86101

87102
def base_install(sql_version)
@@ -152,7 +167,9 @@ def install_sqlserver(features)
152167
windows_feature_source => 'I:\\sources\\sxs',
153168
}
154169
MANIFEST
155-
Helper.instance.apply_manifest(pp)
170+
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
171+
Helper.instance.apply_manifest(pp)
172+
end
156173
end
157174

158175
def run_sql_query(opts = {}, &block)

0 commit comments

Comments
 (0)