summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-03-09 11:50:21 +0000
committerLin Jen-Shin <godfat@godfat.org>2018-03-29 19:40:32 +0800
commit211b2f390c3311f5880b3de6a2fb16f7865ebaae (patch)
tree4e087ba5278183dfa128728a33931f3d5334b551 /qa/spec
parent9a538b9eebd6aed362c6ed86445d96c8e06ffdf2 (diff)
downloadgitlab-ce-211b2f390c3311f5880b3de6a2fb16f7865ebaae.tar.gz
Implement other ssh keys and use ssh-keygen instead
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/runtime/key/dsa_spec.rb9
-rw-r--r--qa/spec/runtime/key/ecdsa_spec.rb17
-rw-r--r--qa/spec/runtime/key/ed25519_spec.rb9
-rw-r--r--qa/spec/runtime/key/rsa_spec.rb2
4 files changed, 36 insertions, 1 deletions
diff --git a/qa/spec/runtime/key/dsa_spec.rb b/qa/spec/runtime/key/dsa_spec.rb
new file mode 100644
index 00000000000..600e7ce4ee6
--- /dev/null
+++ b/qa/spec/runtime/key/dsa_spec.rb
@@ -0,0 +1,9 @@
+describe QA::Runtime::Key::DSA do
+ describe '#public_key' do
+ subject { described_class.new.public_key }
+
+ it 'generates a public DSA key' do
+ expect(subject).to match(%r{\Assh\-dss AAAA[0-9A-Za-z+/]+={0,3}})
+ end
+ end
+end
diff --git a/qa/spec/runtime/key/ecdsa_spec.rb b/qa/spec/runtime/key/ecdsa_spec.rb
new file mode 100644
index 00000000000..55a5c5e5c1b
--- /dev/null
+++ b/qa/spec/runtime/key/ecdsa_spec.rb
@@ -0,0 +1,17 @@
+describe QA::Runtime::Key::ECDSA do
+ describe '#public_key' do
+ [256, 384, 521].each do |bits|
+ it "generates a public #{bits}-bits ECDSA key" do
+ subject = described_class.new(bits).public_key
+
+ expect(subject).to match(%r{\Aecdsa\-sha2\-\w+ AAAA[0-9A-Za-z+/]+={0,3}})
+ end
+ end
+ end
+
+ describe '#new' do
+ it 'does not support arbitrary bits' do
+ expect { described_class.new(123) }.to raise_error(RuntimeError)
+ end
+ end
+end
diff --git a/qa/spec/runtime/key/ed25519_spec.rb b/qa/spec/runtime/key/ed25519_spec.rb
new file mode 100644
index 00000000000..4844e7affdf
--- /dev/null
+++ b/qa/spec/runtime/key/ed25519_spec.rb
@@ -0,0 +1,9 @@
+describe QA::Runtime::Key::ED25519 do
+ describe '#public_key' do
+ subject { described_class.new.public_key }
+
+ it 'generates a public ED25519 key' do
+ expect(subject).to match(%r{\Assh\-ed25519 AAAA[0-9A-Za-z+/]})
+ end
+ end
+end
diff --git a/qa/spec/runtime/key/rsa_spec.rb b/qa/spec/runtime/key/rsa_spec.rb
index 0921f9a7c6b..fbcc7ffdcb4 100644
--- a/qa/spec/runtime/key/rsa_spec.rb
+++ b/qa/spec/runtime/key/rsa_spec.rb
@@ -3,7 +3,7 @@ describe QA::Runtime::Key::RSA do
subject { described_class.new.public_key }
it 'generates a public RSA key' do
- expect(subject).to match(%r{\Assh\-rsa AAAA[0-9A-Za-z+/]+={0,3}\z})
+ expect(subject).to match(%r{\Assh\-rsa AAAA[0-9A-Za-z+/]+={0,3}})
end
end
end