mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 08:04:14 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
72 lines
2.4 KiB
Nix
72 lines
2.4 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
client =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = [ pkgs.upterm ];
|
|
};
|
|
in
|
|
{
|
|
name = "uptermd";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ fleaz ];
|
|
};
|
|
|
|
nodes = {
|
|
server =
|
|
{ config, ... }:
|
|
{
|
|
services.uptermd = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
port = 1337;
|
|
};
|
|
};
|
|
client1 = client;
|
|
client2 = client;
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
server.wait_for_unit("uptermd.service")
|
|
server.systemctl("start network-online.target")
|
|
server.wait_for_unit("network-online.target")
|
|
|
|
# wait for upterm port to be reachable
|
|
client1.wait_until_succeeds("nc -z -v server 1337")
|
|
|
|
# Add SSH hostkeys from the server to both clients
|
|
# uptermd needs an '@cert-authority entry so we need to modify the known_hosts file
|
|
client1.execute("mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
|
|
client1.execute("echo @cert-authority $(cat ~/.ssh/known_hosts) > ~/.ssh/known_hosts")
|
|
client2.execute("mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
|
|
client2.execute("echo @cert-authority $(cat ~/.ssh/known_hosts) > ~/.ssh/known_hosts")
|
|
|
|
client1.wait_for_unit("multi-user.target")
|
|
client1.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
|
client1.wait_until_tty_matches("1", "login: ")
|
|
client1.send_chars("root\n")
|
|
client1.wait_until_succeeds("pgrep -u root bash")
|
|
|
|
client1.execute("ssh-keygen -t ed25519 -N \"\" -f /root/.ssh/id_ed25519")
|
|
client1.send_chars("TERM=xterm upterm host --server ssh://server:1337 --force-command hostname -- bash > /tmp/session-details\n")
|
|
client1.wait_for_file("/tmp/session-details")
|
|
client1.send_key("q")
|
|
|
|
# uptermd can't connect if we don't have a keypair
|
|
client2.execute("ssh-keygen -t ed25519 -N \"\" -f /root/.ssh/id_ed25519")
|
|
|
|
# Grep the ssh connect command from the output of 'upterm host'
|
|
ssh_command = client1.succeed("grep 'SSH Session' /tmp/session-details | cut -d':' -f2-").strip()
|
|
|
|
# Connect with client2. Because we used '--force-command hostname' we should get "client1" as the output
|
|
output = client2.succeed(ssh_command)
|
|
|
|
assert output.strip() == "client1"
|
|
'';
|
|
}
|
|
)
|