Skip to content

Commit

Permalink
Make co/authentication rotation robust in SNO env test (openshift#2695)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingxingxia authored Mar 3, 2022
1 parent bb16c2a commit 604c675
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions features/step_definitions/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@
org_oauth_json = org_oauth.to_json
_admin = admin
teardown_add {
puts "Original CR to restore:", org_oauth_json
@result = admin.cli_exec(:get, resource: 'oauth', resource_name: name, o: 'yaml')
if @result[:success]
org_oauth_now = @result[:parsed]
else
raise "Could not get OAuth: #{name}"
end
print "Original CR to restore:\n", org_oauth_json
# Use replace instead of patch, otherwise the patch with org_oauth_json can only add or modify fields, but will not remove fields that were added
@result = _admin.cli_exec(:replace, f: "-", _stdin: org_oauth_json)
raise "Cannot restore OAuth: #{name}" unless @result[:success]
sleep 60
# Check 'spec' first because pods only roll out when 'spec' had been changed
if org_oauth_now['spec'] != org_oauth['spec']
step %Q/authentication successfully rolls out after config changes/
end
}
end

Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/operators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
interval_time = 5
timeout = Integer(timeout) rescue 60
interval_time = 20 if timeout > 100
interval_time = 5 if env.nodes.length == 1 # interval needs to be short because rotation is quick in SNO env
actual_results = {}
stats = {}

Expand Down

0 comments on commit 604c675

Please sign in to comment.