summaryrefslogtreecommitdiff
path: root/qa/qa/resource/ssh_key.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/ssh_key.rb')
-rw-r--r--qa/qa/resource/ssh_key.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/qa/qa/resource/ssh_key.rb b/qa/qa/resource/ssh_key.rb
index b948bf3969b..317d70ef2c3 100644
--- a/qa/qa/resource/ssh_key.rb
+++ b/qa/qa/resource/ssh_key.rb
@@ -6,6 +6,7 @@ module QA
extend Forwardable
attr_reader :title
+ attr_accessor :expires_at
attribute :id
@@ -53,13 +54,27 @@ module QA
def api_post_body
{
title: title,
- key: public_key
+ key: public_key,
+ expires_at: expires_at
}
end
def api_delete_path
"/user/keys/#{id}"
end
+
+ def replicated?
+ api_client = Runtime::API::Client.new(:geo_secondary)
+
+ QA::Runtime::Logger.debug('Checking for SSH key replication')
+
+ Support::Retrier.retry_until(max_duration: QA::EE::Runtime::Geo.max_db_replication_time, sleep_interval: 3) do
+ response = get Runtime::API::Request.new(api_client, api_get_path).url
+
+ response.code == QA::Support::Api::HTTP_STATUS_OK &&
+ parse_body(response)[:title].include?(title)
+ end
+ end
end
end
end