mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 09:36:20 +09:00
nixos/tests/olivetin: init
This commit is contained in:
parent
965558108f
commit
37914c29be
3 changed files with 60 additions and 0 deletions
|
@ -966,6 +966,7 @@ in
|
|||
oddjobd = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./oddjobd.nix { };
|
||||
obs-studio = runTest ./obs-studio.nix;
|
||||
oh-my-zsh = handleTest ./oh-my-zsh.nix { };
|
||||
olivetin = runTest ./olivetin.nix;
|
||||
ollama = runTest ./ollama.nix;
|
||||
ollama-cuda = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-cuda.nix;
|
||||
ollama-rocm = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-rocm.nix;
|
||||
|
|
57
nixos/tests/olivetin.nix
Normal file
57
nixos/tests/olivetin.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "olivetin";
|
||||
meta.maintainers = with lib.maintainers; [ defelo ];
|
||||
|
||||
nodes.machine = {
|
||||
services.olivetin = {
|
||||
enable = true;
|
||||
settings = {
|
||||
actions = [
|
||||
{
|
||||
id = "hello_world";
|
||||
title = "Say Hello";
|
||||
shell = "echo -n 'Hello World!' | tee /tmp/result";
|
||||
}
|
||||
];
|
||||
};
|
||||
extraConfigFiles = [
|
||||
(builtins.toFile "secrets.yaml" ''
|
||||
actions:
|
||||
- id: secret
|
||||
title: Secret Action
|
||||
shell: echo -n secret > /tmp/result2
|
||||
'')
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
interactive.nodes.machine = {
|
||||
services.olivetin.settings.ListenAddressSingleHTTPFrontend = "0.0.0.0:8000";
|
||||
networking.firewall.allowedTCPPorts = [ 8000 ];
|
||||
virtualisation.forwardPorts = [
|
||||
{
|
||||
from = "host";
|
||||
host.port = 8000;
|
||||
guest.port = 8000;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import json
|
||||
|
||||
machine.wait_for_unit("olivetin.service")
|
||||
machine.wait_for_open_port(8000)
|
||||
|
||||
response = json.loads(machine.succeed("curl http://localhost:8000/api/StartActionByGetAndWait/hello_world"))
|
||||
assert response["logEntry"]["exitCode"] == 0
|
||||
assert response["logEntry"]["output"] == "Hello World!"
|
||||
assert machine.succeed("cat /tmp/result") == "Hello World!"
|
||||
|
||||
response = json.loads(machine.succeed("curl http://localhost:8000/api/StartActionByGetAndWait/secret"))
|
||||
assert response["logEntry"]["exitCode"] == 0
|
||||
assert machine.succeed("cat /tmp/result2") == "secret"
|
||||
'';
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
buildNpmPackage,
|
||||
installShellFiles,
|
||||
versionCheckHook,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
buildGoModule (
|
||||
|
@ -122,6 +123,7 @@ buildGoModule (
|
|||
|
||||
passthru = {
|
||||
inherit gen webui;
|
||||
tests = { inherit (nixosTests) olivetin; };
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue