at 23.11-pre 1.9 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: 2 3let 4 testPort = 8888; 5 testUser = "testerman"; 6 testPass = "password"; 7 testEmail = "test.testerman@test.com"; 8in 9{ 10 name = "atuin"; 11 meta.maintainers = with lib.maintainers; [ devusb ]; 12 13 nodes = { 14 server = 15 { ... }: 16 { 17 services.atuin = { 18 enable = true; 19 port = testPort; 20 host = "0.0.0.0"; 21 openFirewall = true; 22 openRegistration = true; 23 }; 24 }; 25 26 client = 27 { ... }: 28 { }; 29 30 }; 31 32 testScript = with pkgs; '' 33 start_all() 34 35 # wait for atuin server startup 36 server.wait_for_unit("atuin.service") 37 server.wait_for_open_port(${toString testPort}) 38 39 # configure atuin client on server node 40 server.execute("mkdir -p ~/.config/atuin") 41 server.execute("echo 'sync_address = \"http://localhost:${toString testPort}\"' > ~/.config/atuin/config.toml") 42 43 # register with atuin server on server node 44 server.succeed("${atuin}/bin/atuin register -u ${testUser} -p ${testPass} -e ${testEmail}") 45 _, key = server.execute("${atuin}/bin/atuin key") 46 47 # store test record in atuin server and sync 48 server.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history start 'shazbot'") 49 server.succeed("${atuin}/bin/atuin sync") 50 51 # configure atuin client on client node 52 client.execute("mkdir -p ~/.config/atuin") 53 client.execute("echo 'sync_address = \"http://server:${toString testPort}\"' > ~/.config/atuin/config.toml") 54 55 # log in to atuin server on client node 56 client.succeed(f"${atuin}/bin/atuin login -u ${testUser} -p ${testPass} -k \"{key}\"") 57 58 # pull records from atuin server 59 client.succeed("${atuin}/bin/atuin sync -f") 60 61 # check for test record 62 client.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history list | grep shazbot") 63 ''; 64})