Skip to content

Commit

Permalink
QE: Fix update_ca() for hostname rename tests (#7680)
Browse files Browse the repository at this point in the history
  • Loading branch information
nodeg authored Oct 12, 2023
1 parent a91c589 commit 74bd39d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion testsuite/features/step_definitions/command_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,8 @@
end

# Update the server CA certificate since it changed, otherwise all API and browser uses will fail
update_ca
update_ca('controller')
update_ca('proxy')

# Reset the API client to take the new CA into account
reset_api_client
Expand Down
20 changes: 15 additions & 5 deletions testsuite/features/support/commonlib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,21 @@ def file_inject(node, local_file, remote_file)
end

# This function updates the server certificate on the controller node
def update_ca
def update_ca(node)
server_ip = get_target('server').public_ip
server_name = get_target('server').full_hostname
puts `rm /etc/pki/trust/anchors/*;
wget http://#{server_ip}/pub/RHN-ORG-TRUSTED-SSL-CERT -O /etc/pki/trust/anchors/#{server_name}.cert &&
update-ca-certificates &&
certutil -d sql:/root/.pki/nssdb -A -t TC -n "susemanager" -i /etc/pki/trust/anchors/#{server_name}.cert`

case node
when 'proxy'
command = "wget http://#{server_ip}/pub/RHN-ORG-TRUSTED-SSL-CERT -O /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT; " \
'update-ca-certificates;'
get_target('proxy').run('rm /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT', verbose: true)
get_target('proxy').run(command, verbose: true)
else
# controller
puts `rm /etc/pki/trust/anchors/*;
wget http://#{server_ip}/pub/RHN-ORG-TRUSTED-SSL-CERT -O /etc/pki/trust/anchors/#{server_name}.cert &&
update-ca-certificates &&
certutil -d sql:/root/.pki/nssdb -A -t TC -n "susemanager" -i /etc/pki/trust/anchors/#{server_name}.cert`
end
end

0 comments on commit 74bd39d

Please sign in to comment.