nixos/tests/sharkey: init
This commit is contained in:
parent
11d8fbb0b6
commit
01971a6323
@ -1277,6 +1277,7 @@ in
|
|||||||
sgt-puzzles = runTest ./sgt-puzzles.nix;
|
sgt-puzzles = runTest ./sgt-puzzles.nix;
|
||||||
shadow = runTest ./shadow.nix;
|
shadow = runTest ./shadow.nix;
|
||||||
shadowsocks = handleTest ./shadowsocks { };
|
shadowsocks = handleTest ./shadowsocks { };
|
||||||
|
sharkey = runTest ./web-apps/sharkey.nix;
|
||||||
shattered-pixel-dungeon = runTest ./shattered-pixel-dungeon.nix;
|
shattered-pixel-dungeon = runTest ./shattered-pixel-dungeon.nix;
|
||||||
shiori = runTest ./shiori.nix;
|
shiori = runTest ./shiori.nix;
|
||||||
signal-desktop = runTest ./signal-desktop.nix;
|
signal-desktop = runTest ./signal-desktop.nix;
|
||||||
|
|||||||
55
nixos/tests/web-apps/sharkey.nix
Normal file
55
nixos/tests/web-apps/sharkey.nix
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
meilisearchKey = "TESTKEY-naXRkVX7nhvLaGOmGGuicDKxZAj0khEaoOZPeEZafv8w9j8V6aKb0NVdXRChL5kR";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "sharkey";
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.sharkey = {
|
||||||
|
enable = true;
|
||||||
|
setupMeilisearch = true;
|
||||||
|
environmentFiles = [ "/run/secrets/sharkey-env" ];
|
||||||
|
settings = {
|
||||||
|
url = "http://exampleurl.invalid";
|
||||||
|
meilisearch.index = "exampleurl_invalid";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.meilisearch.masterKeyEnvironmentFile = pkgs.writeText "meilisearch-key" ''
|
||||||
|
MEILI_MASTER_KEY=${meilisearchKey}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
let
|
||||||
|
createIndexPayload = builtins.toJSON {
|
||||||
|
description = "Sharkey API key";
|
||||||
|
actions = [ "*" ];
|
||||||
|
indexes = [ "exampleurl_invalid---notes" ];
|
||||||
|
expiresAt = null;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
''
|
||||||
|
import json
|
||||||
|
|
||||||
|
with subtest("Setting up Meilisearch API key and index"):
|
||||||
|
machine.wait_for_unit("meilisearch.service")
|
||||||
|
machine.wait_for_open_port(7700)
|
||||||
|
|
||||||
|
json_body = '${createIndexPayload}'
|
||||||
|
create_index_result = json.loads(machine.succeed(f"curl -s -X POST 'http://localhost:7700/keys' -H 'Content-Type: application/json' -H 'Authorization: Bearer ${meilisearchKey}' --data-binary '{json_body}'"))
|
||||||
|
machine.succeed(f"mkdir /run/secrets; echo 'MK_CONFIG_MEILISEARCH_APIKEY={create_index_result["key"]}' > /run/secrets/sharkey-env")
|
||||||
|
|
||||||
|
with subtest("Testing Sharkey is running and listening to HTTP requests"):
|
||||||
|
machine.systemctl("restart sharkey")
|
||||||
|
machine.wait_for_open_port(3000)
|
||||||
|
|
||||||
|
machine.succeed("curl --fail http://localhost:3000")
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ srxl ];
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
stdenv,
|
stdenv,
|
||||||
lib,
|
lib,
|
||||||
fetchFromGitLab,
|
fetchFromGitLab,
|
||||||
|
nixosTests,
|
||||||
bash,
|
bash,
|
||||||
cairo,
|
cairo,
|
||||||
cctools,
|
cctools,
|
||||||
@ -151,6 +152,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
runHook postFixup
|
runHook postFixup
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests.sharkey = nixosTests.sharkey;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Sharkish microblogging platform";
|
description = "Sharkish microblogging platform";
|
||||||
homepage = "https://joinsharkey.org";
|
homepage = "https://joinsharkey.org";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user