Skip to content

CAT-1208 : Fix CI failures #451

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
Aug 2, 2023
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
7 changes: 6 additions & 1 deletion spec/acceptance/sqlserver_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ def ensure_sqlserver_instance(inst_name, ensure_val = 'present')
security_mode => 'SQL',
sa_pwd => 'Pupp3t1@',
windows_feature_source => 'I:\\sources\\sxs',
install_switches => {
'SkipInstallerRunCheck' => 'True',
},
}
MANIFEST
apply_manifest(pp, catch_failures: true)
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
apply_manifest(pp, catch_failures: true)
end
end

context 'Testing sqlserver::config' do
Expand Down
21 changes: 19 additions & 2 deletions spec/spec_helper_acceptance_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ class Helper
SQL_ADMIN_PASS = 'Pupp3t1@'
USER = Helper.instance.run_shell('$env:UserName').stdout.chomp

def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, error_matcher = nil)
try = 0
begin
try += 1
yield
rescue StandardError => e
raise unless try < max_retry_count && (error_matcher.nil? || e.message =~ error_matcher)

sleep retry_wait_interval_secs
retry
end
end

RSpec.configure do |c|
c.before(:suite) do
Helper.instance.run_shell('puppet module install puppetlabs-mount_iso')
Expand Down Expand Up @@ -81,7 +94,9 @@ def mount_iso(opts = {})
drive_letter => '#{drive_letter}',
}
MANIFEST
Helper.instance.apply_manifest(pp)
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
Helper.instance.apply_manifest(pp)
end
end

def base_install(sql_version)
Expand Down Expand Up @@ -152,7 +167,9 @@ def install_sqlserver(features)
windows_feature_source => 'I:\\sources\\sxs',
}
MANIFEST
Helper.instance.apply_manifest(pp)
retry_on_error_matching(10, 5, %r{apply manifest failed}) do
Helper.instance.apply_manifest(pp)
end
end

def run_sql_query(opts = {}, &block)
Expand Down