ssh: add some basic tests

This commit is contained in:
Robert Helgesson 2019-03-19 23:00:17 +01:00
parent eec78fbd1e
commit 989e636d98
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
6 changed files with 99 additions and 2 deletions

View File

@ -26,7 +26,10 @@ import nmt {
mbsync = ./modules/programs/mbsync.nix;
texlive-minimal = ./modules/programs/texlive-minimal.nix;
xresources = ./modules/xresources.nix;
} // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
}
// pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
i3-keybindings = ./modules/services/window-managers/i3-keybindings.nix;
} // import ./modules/programs/tmux;
}
// import ./modules/programs/tmux
// import ./modules/programs/ssh;
}

View File

@ -0,0 +1,15 @@
Host *
ForwardAgent no
Compression no
ServerAliveInterval 0
HashKnownHosts no
UserKnownHostsFile ~/.ssh/known_hosts
ControlMaster no
ControlPath ~/.ssh/master-%r@%n:%p
ControlPersist no

View File

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.ssh = {
enable = true;
};
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContent home-files/.ssh/config ${./default-config-expected.conf}
'';
};
}

View File

@ -0,0 +1,4 @@
{
ssh-defaults = ./default-config.nix;
ssh-match-blocks = ./match-blocks-attrs.nix;
}

View File

@ -0,0 +1,25 @@
Host * !github.com
Port 516
IdentityFile file1
IdentityFile file2
Host abc
ProxyJump jump-host
Host xyz
ServerAliveInterval 60
IdentityFile file
Host *
ForwardAgent no
Compression no
ServerAliveInterval 0
HashKnownHosts no
UserKnownHostsFile ~/.ssh/known_hosts
ControlMaster no
ControlPath ~/.ssh/master-%r@%n:%p
ControlPersist no

View File

@ -0,0 +1,34 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.ssh = {
enable = true;
matchBlocks = {
abc = {
identityFile = null;
proxyJump = "jump-host";
};
xyz = {
identityFile = "file";
serverAliveInterval = 60;
};
"* !github.com" = {
identityFile = ["file1" "file2"];
port = 516;
};
};
};
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContent \
home-files/.ssh/config \
${./match-blocks-attrs-expected.conf}
'';
};
}