depot/third_party/nixpkgs/nixos/tests/livebook-service.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

43 lines
1.1 KiB
Nix

import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "livebook-service";
nodes = {
machine = { config, pkgs, ... }: {
imports = [
./common/user-account.nix
];
services.livebook = {
enableUserService = true;
port = 20123;
environmentFile = pkgs.writeText "livebook.env" ''
LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
'';
options = {
cookie = "chocolate chip";
};
};
};
};
testScript = { nodes, ... }:
let
user = nodes.machine.config.users.users.alice;
sudo = lib.concatStringsSep " " [
"XDG_RUNTIME_DIR=/run/user/${toString user.uid}"
"sudo"
"--preserve-env=XDG_RUNTIME_DIR"
"-u"
"alice"
];
in
''
machine.wait_for_unit("multi-user.target")
machine.succeed("loginctl enable-linger alice")
machine.wait_until_succeeds("${sudo} systemctl --user is-active livebook.service")
machine.wait_for_open_port(20123)
machine.succeed("curl -L localhost:20123 | grep 'Type password'")
'';
})