1 import ./make-test-python.nix ({ pkgs, lib, ... }:
5 testUser = "testerman";
7 testEmail = "test.testerman@test.com";
11 meta.maintainers = with lib.maintainers; [ devusb ];
17 services.postgresql.enable = true;
24 openRegistration = true;
34 testScript = with pkgs; ''
37 # wait for atuin server startup
38 server.wait_for_unit("atuin.service")
39 server.wait_for_open_port(${toString testPort})
41 # configure atuin client on server node
42 server.execute("mkdir -p ~/.config/atuin")
43 server.execute("echo 'sync_address = \"http://localhost:${toString testPort}\"' > ~/.config/atuin/config.toml")
45 # register with atuin server on server node
46 server.succeed("${atuin}/bin/atuin register -u ${testUser} -p ${testPass} -e ${testEmail}")
47 _, key = server.execute("${atuin}/bin/atuin key")
49 # store test record in atuin server and sync
50 server.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history start 'shazbot'")
51 server.succeed("${atuin}/bin/atuin sync")
53 # configure atuin client on client node
54 client.execute("mkdir -p ~/.config/atuin")
55 client.execute("echo 'sync_address = \"http://server:${toString testPort}\"' > ~/.config/atuin/config.toml")
57 # log in to atuin server on client node
58 client.succeed(f"${atuin}/bin/atuin login -u ${testUser} -p ${testPass} -k \"{key}\"")
60 # pull records from atuin server
61 client.succeed("${atuin}/bin/atuin sync -f")
63 # check for test record
64 client.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history list | grep shazbot")