mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
atuin: switch to runTest to run the VM test
This commit is contained in:
parent
3923625713
commit
5917e244b6
2 changed files with 48 additions and 39 deletions
|
@ -140,7 +140,7 @@ in {
|
||||||
atd = handleTest ./atd.nix {};
|
atd = handleTest ./atd.nix {};
|
||||||
atop = handleTest ./atop.nix {};
|
atop = handleTest ./atop.nix {};
|
||||||
atticd = runTest ./atticd.nix;
|
atticd = runTest ./atticd.nix;
|
||||||
atuin = handleTest ./atuin.nix {};
|
atuin = runTest ./atuin.nix;
|
||||||
audiobookshelf = handleTest ./audiobookshelf.nix {};
|
audiobookshelf = handleTest ./audiobookshelf.nix {};
|
||||||
auth-mysql = handleTest ./auth-mysql.nix {};
|
auth-mysql = handleTest ./auth-mysql.nix {};
|
||||||
authelia = handleTest ./authelia.nix {};
|
authelia = handleTest ./authelia.nix {};
|
||||||
|
|
|
@ -1,36 +1,46 @@
|
||||||
import ./make-test-python.nix (
|
{ lib, ... }:
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
testPort = 8888;
|
testPort = 8888;
|
||||||
testUser = "testerman";
|
testUser = "testerman";
|
||||||
testPass = "password";
|
testPass = "password";
|
||||||
testEmail = "test.testerman@test.com";
|
testEmail = "test.testerman@test.com";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "atuin";
|
name = "atuin";
|
||||||
meta.maintainers = with lib.maintainers; [ devusb ];
|
meta.maintainers = with lib.maintainers; [ devusb ];
|
||||||
|
|
||||||
nodes = {
|
|
||||||
server =
|
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
services.postgresql.enable = true;
|
|
||||||
|
|
||||||
services.atuin = {
|
|
||||||
enable = true;
|
|
||||||
port = testPort;
|
|
||||||
host = "0.0.0.0";
|
|
||||||
openFirewall = true;
|
|
||||||
openRegistration = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
client = { ... }: { };
|
|
||||||
|
|
||||||
|
defaults =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.atuin
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = with pkgs; ''
|
nodes = {
|
||||||
|
server =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.postgresql.enable = true;
|
||||||
|
|
||||||
|
services.atuin = {
|
||||||
|
enable = true;
|
||||||
|
port = testPort;
|
||||||
|
host = "0.0.0.0";
|
||||||
|
openFirewall = true;
|
||||||
|
openRegistration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
client = { ... }: { };
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
{ nodes, ... }:
|
||||||
|
#python
|
||||||
|
''
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
# wait for atuin server startup
|
# wait for atuin server startup
|
||||||
|
@ -42,25 +52,24 @@ import ./make-test-python.nix (
|
||||||
server.execute("echo 'sync_address = \"http://localhost:${toString testPort}\"' > ~/.config/atuin/config.toml")
|
server.execute("echo 'sync_address = \"http://localhost:${toString testPort}\"' > ~/.config/atuin/config.toml")
|
||||||
|
|
||||||
# register with atuin server on server node
|
# register with atuin server on server node
|
||||||
server.succeed("${atuin}/bin/atuin register -u ${testUser} -p ${testPass} -e ${testEmail}")
|
server.succeed("atuin register -u ${testUser} -p ${testPass} -e ${testEmail}")
|
||||||
_, key = server.execute("${atuin}/bin/atuin key")
|
_, key = server.execute("atuin key")
|
||||||
|
|
||||||
# store test record in atuin server and sync
|
# store test record in atuin server and sync
|
||||||
server.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history start 'shazbot'")
|
server.succeed("ATUIN_SESSION=$(atuin uuid) atuin history start 'shazbot'")
|
||||||
server.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin sync")
|
server.succeed("ATUIN_SESSION=$(atuin uuid) atuin sync")
|
||||||
|
|
||||||
# configure atuin client on client node
|
# configure atuin client on client node
|
||||||
client.execute("mkdir -p ~/.config/atuin")
|
client.execute("mkdir -p ~/.config/atuin")
|
||||||
client.execute("echo 'sync_address = \"http://server:${toString testPort}\"' > ~/.config/atuin/config.toml")
|
client.execute("echo 'sync_address = \"http://server:${toString testPort}\"' > ~/.config/atuin/config.toml")
|
||||||
|
|
||||||
# log in to atuin server on client node
|
# log in to atuin server on client node
|
||||||
client.succeed(f"${atuin}/bin/atuin login -u ${testUser} -p ${testPass} -k \"{key}\"")
|
client.succeed(f"atuin login -u ${testUser} -p ${testPass} -k \"{key}\"")
|
||||||
|
|
||||||
# pull records from atuin server
|
# pull records from atuin server
|
||||||
client.succeed("${atuin}/bin/atuin sync -f")
|
client.succeed("atuin sync -f")
|
||||||
|
|
||||||
# check for test record
|
# check for test record
|
||||||
client.succeed("ATUIN_SESSION=$(${atuin}/bin/atuin uuid) ${atuin}/bin/atuin history list | grep shazbot")
|
client.succeed("ATUIN_SESSION=$(atuin uuid) atuin history list | grep shazbot")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue