mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
ssh: add some basic tests
This commit is contained in:
parent
eec78fbd1e
commit
989e636d98
6 changed files with 99 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
15
tests/modules/programs/ssh/default-config-expected.conf
Normal file
15
tests/modules/programs/ssh/default-config-expected.conf
Normal 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
|
||||
|
||||
|
16
tests/modules/programs/ssh/default-config.nix
Normal file
16
tests/modules/programs/ssh/default-config.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
}
|
4
tests/modules/programs/ssh/default.nix
Normal file
4
tests/modules/programs/ssh/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
ssh-defaults = ./default-config.nix;
|
||||
ssh-match-blocks = ./match-blocks-attrs.nix;
|
||||
}
|
25
tests/modules/programs/ssh/match-blocks-attrs-expected.conf
Normal file
25
tests/modules/programs/ssh/match-blocks-attrs-expected.conf
Normal 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
|
||||
|
||||
|
34
tests/modules/programs/ssh/match-blocks-attrs.nix
Normal file
34
tests/modules/programs/ssh/match-blocks-attrs.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue