From ff310146870a130477a4fe47e5f53bfe2a77bc74 Mon Sep 17 00:00:00 2001
From: Antoine Eiche <lewo@abesis.fr>
Date: Fri, 8 Feb 2019 09:20:40 +0100
Subject: [PATCH] nixos/tests/ec2: reuse ssh keys from ssh-keys.nix

---
 nixos/tests/common/ec2.nix      | 12 ------------
 nixos/tests/ec2.nix             |  4 ++++
 nixos/tests/openstack-image.nix |  4 ++++
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/nixos/tests/common/ec2.nix b/nixos/tests/common/ec2.nix
index 99a39473b617..1e69b63191a7 100644
--- a/nixos/tests/common/ec2.nix
+++ b/nixos/tests/common/ec2.nix
@@ -46,16 +46,4 @@ with pkgs.lib;
           ${script}
         '';
     };
-
-  snakeOilPrivateKey = ''
-    -----BEGIN OPENSSH PRIVATE KEY-----
-    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
-    QyNTUxOQAAACDEPmwZv5dDPrMUaq0dDP+6eBTTe+QNrz14KBEIdhHd1QAAAJDufJ4S7nye
-    EgAAAAtzc2gtZWQyNTUxOQAAACDEPmwZv5dDPrMUaq0dDP+6eBTTe+QNrz14KBEIdhHd1Q
-    AAAECgwbDlYATM5/jypuptb0GF/+zWZcJfoVIFBG3LQeRyGsQ+bBm/l0M+sxRqrR0M/7p4
-    FNN75A2vPXgoEQh2Ed3VAAAADEVDMiB0ZXN0IGtleQE=
-    -----END OPENSSH PRIVATE KEY-----
-  '';
-
-  snakeOilPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMQ+bBm/l0M+sxRqrR0M/7p4FNN75A2vPXgoEQh2Ed3V EC2 test key";
 }
diff --git a/nixos/tests/ec2.nix b/nixos/tests/ec2.nix
index db959a63e40f..384fce67c227 100644
--- a/nixos/tests/ec2.nix
+++ b/nixos/tests/ec2.nix
@@ -41,6 +41,10 @@ let
       ];
     }).config.system.build.amazonImage;
 
+  sshKeys = import ./ssh-keys.nix pkgs;
+  snakeOilPrivateKey = sshKeys.snakeOilPrivateKey.text;
+  snakeOilPublicKey = sshKeys.snakeOilPublicKey;
+
 in {
   boot-ec2-nixops = makeEc2Test {
     name         = "nixops-userdata";
diff --git a/nixos/tests/openstack-image.nix b/nixos/tests/openstack-image.nix
index c7b28126e508..d0225016ab76 100644
--- a/nixos/tests/openstack-image.nix
+++ b/nixos/tests/openstack-image.nix
@@ -19,6 +19,10 @@ let
       ];
     }).config.system.build.openstackImage;
 
+  sshKeys = import ./ssh-keys.nix pkgs;
+  snakeOilPrivateKey = sshKeys.snakeOilPrivateKey.text;
+  snakeOilPublicKey = sshKeys.snakeOilPublicKey;
+
 in {
   metadata = makeEc2Test {
     name = "openstack-ec2-metadata";