summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-03-09 15:54:20 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-03-29 19:40:32 +0800
commit9a538b9eebd6aed362c6ed86445d96c8e06ffdf2 (patch)
tree93c933872c10f026f3cc4d2be94db0460daa67b8
parent8230b774b5a6375d9b84c71e72c8e41e3bfd7fad (diff)
downloadgitlab-ce-9a538b9eebd6aed362c6ed86445d96c8e06ffdf2.tar.gz
Introduce Key namespace so we could put more keys
-rw-r--r--qa/qa.rb5
-rw-r--r--qa/qa/runtime/key/rsa.rb23
-rw-r--r--qa/qa/runtime/rsa_key.rb21
-rw-r--r--qa/qa/specs/features/project/add_deploy_key_spec.rb2
-rw-r--r--qa/qa/specs/features/project/deploy_key_clone_spec.rb2
-rw-r--r--qa/spec/runtime/key/rsa_spec.rb (renamed from qa/spec/runtime/rsa_key.rb)2
6 files changed, 30 insertions, 25 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 7220af5088e..f2ad43cd04a 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -11,9 +11,12 @@ module QA
autoload :Scenario, 'qa/runtime/scenario'
autoload :Browser, 'qa/runtime/browser'
autoload :Env, 'qa/runtime/env'
- autoload :RSAKey, 'qa/runtime/rsa_key'
autoload :Address, 'qa/runtime/address'
autoload :API, 'qa/runtime/api'
+
+ module Key
+ autoload :RSA, 'qa/runtime/key/rsa'
+ end
end
##
diff --git a/qa/qa/runtime/key/rsa.rb b/qa/qa/runtime/key/rsa.rb
new file mode 100644
index 00000000000..faa6b47b5a0
--- /dev/null
+++ b/qa/qa/runtime/key/rsa.rb
@@ -0,0 +1,23 @@
+require 'net/ssh'
+require 'forwardable'
+
+module QA
+ module Runtime
+ module Key
+ class RSA
+ extend Forwardable
+
+ attr_reader :key
+ def_delegators :@key, :fingerprint, :to_pem
+
+ def initialize(bits = 4096)
+ @key = OpenSSL::PKey::RSA.new(bits)
+ end
+
+ def public_key
+ @public_key ||= "#{key.ssh_type} #{[key.to_blob].pack('m0')}"
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/runtime/rsa_key.rb b/qa/qa/runtime/rsa_key.rb
deleted file mode 100644
index fcd7dcc4f02..00000000000
--- a/qa/qa/runtime/rsa_key.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'net/ssh'
-require 'forwardable'
-
-module QA
- module Runtime
- class RSAKey
- extend Forwardable
-
- attr_reader :key
- def_delegators :@key, :fingerprint, :to_pem
-
- def initialize(bits = 4096)
- @key = OpenSSL::PKey::RSA.new(bits)
- end
-
- def public_key
- @public_key ||= "#{key.ssh_type} #{[key.to_blob].pack('m0')}"
- end
- end
- end
-end
diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb
index b9998dda895..79e5ebe3633 100644
--- a/qa/qa/specs/features/project/add_deploy_key_spec.rb
+++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb
@@ -4,7 +4,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
- key = Runtime::RSAKey.new
+ key = Runtime::Key::RSA.new
deploy_key_title = 'deploy key title'
deploy_key_value = key.public_key
diff --git a/qa/qa/specs/features/project/deploy_key_clone_spec.rb b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
index 19d3c83758a..0c09f8168d9 100644
--- a/qa/qa/specs/features/project/deploy_key_clone_spec.rb
+++ b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
@@ -3,7 +3,7 @@ require 'digest/sha1'
module QA
feature 'cloning code using a deploy key', :core, :docker do
let(:runner_name) { "qa-runner-#{Time.now.to_i}" }
- let(:key) { Runtime::RSAKey.new }
+ let(:key) { Runtime::Key::RSA.new }
given(:project) do
Factory::Resource::Project.fabricate! do |resource|
diff --git a/qa/spec/runtime/rsa_key.rb b/qa/spec/runtime/key/rsa_spec.rb
index 6d7ab4dcd2e..0921f9a7c6b 100644
--- a/qa/spec/runtime/rsa_key.rb
+++ b/qa/spec/runtime/key/rsa_spec.rb
@@ -1,4 +1,4 @@
-describe QA::Runtime::RSAKey do
+describe QA::Runtime::Key::RSA do
describe '#public_key' do
subject { described_class.new.public_key }