summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Wininger <fw.centrale@gmail.com>2022-04-15 18:10:17 +0200
committerFlorian Wininger <fw.centrale@gmail.com>2022-04-15 18:10:49 +0200
commit85ebe31697d0ca2fae1542b952a83aea10e367c1 (patch)
tree0bf5871a862c3e13c62396d398f20a6ae1e9de19
parent7a5b6b6a72c153304dda633423495e8337d07b9e (diff)
downloadnet-ssh-85ebe31697d0ca2fae1542b952a83aea10e367c1.tar.gz
Update tests suite
-rw-r--r--Dockerfile13
-rw-r--r--test/test_key_factory.rb15
2 files changed, 21 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index ead5bfa..921f72b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,17 @@
ARG RUBY_VERSION=3.1
FROM ruby:${RUBY_VERSION}
+RUN apt update && apt install -y openssh-server sudo netcat \
+ && useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_1' \
+ && useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_2' \
+ && echo net_ssh_1:foopwd | chpasswd \
+ && echo net_ssh_2:foo2pwd | chpasswd \
+ && mkdir -p /home/net_ssh_1/.ssh \
+ && mkdir -p /home/net_ssh_2/.ssh \
+ && echo "net_ssh_1 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
+ && echo "net_ssh_2 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
+ && ssh-keygen -f /etc/ssh/users_ca -N ''
+
ENV INSTALL_PATH="/netssh"
WORKDIR $INSTALL_PATH
@@ -13,4 +24,4 @@ RUN gem install bundler && bundle install
COPY . $INSTALL_PATH/
-CMD rake test
+CMD service ssh start && rake test && NET_SSH_NO_ED25519=1 rake test
diff --git a/test/test_key_factory.rb b/test/test_key_factory.rb
index 2254f33..b0ba6f5 100644
--- a/test/test_key_factory.rb
+++ b/test/test_key_factory.rb
@@ -131,9 +131,10 @@ class TestKeyFactory < NetSSHTest
end
def test_load_should_parse_openssh_format_private_ecdsa_sha2_nistp256_key
+ return if ENV['NET_SSH_NO_ED25519']
+
File.expects(:read).with(@key_file).returns(ecdsa_sha2_nistp256_key_openssh)
- assert_equal ecdsa_sha2_nistp256_key.to_blob,
- Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
+ assert_equal ecdsa_sha2_nistp256_key.to_blob, Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
end
def test_load_unencrypted_private_ecdsa_sha2_nistp384_key_should_have_fp_md5
@@ -147,9 +148,10 @@ class TestKeyFactory < NetSSHTest
end
def test_load_should_parse_openssh_format_private_ecdsa_sha2_nistp384_key
+ return if ENV['NET_SSH_NO_ED25519']
+
File.expects(:read).with(@key_file).returns(ecdsa_sha2_nistp384_key_openssh)
- assert_equal ecdsa_sha2_nistp384_key.to_blob,
- Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
+ assert_equal ecdsa_sha2_nistp384_key.to_blob, Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
end
def test_load_unencrypted_private_ecdsa_sha2_nistp521_key_should_have_fp_md5
@@ -163,9 +165,10 @@ class TestKeyFactory < NetSSHTest
end
def test_load_should_parse_openssh_format_private_ecdsa_sha2_nistp521_key
+ return if ENV['NET_SSH_NO_ED25519']
+
File.expects(:read).with(@key_file).returns(ecdsa_sha2_nistp521_key_openssh)
- assert_equal ecdsa_sha2_nistp521_key.to_blob,
- Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
+ assert_equal ecdsa_sha2_nistp521_key.to_blob, Net::SSH::KeyFactory.load_private_key('/key-file').to_blob
end
def test_load_public_ecdsa_sha2_nistp256_key_should_return_key