nixosTests.your_spotify: migrate to runTest

Part Of #386873
This commit is contained in:
Martin Weinelt
2025-03-14 22:57:44 +01:00
parent 2a33e128e1
commit 8667777300
2 changed files with 28 additions and 30 deletions

View File

@@ -1301,7 +1301,7 @@ in {
yabar = handleTest ./yabar.nix {}; yabar = handleTest ./yabar.nix {};
ydotool = handleTest ./ydotool.nix {}; ydotool = handleTest ./ydotool.nix {};
yggdrasil = handleTest ./yggdrasil.nix {}; yggdrasil = handleTest ./yggdrasil.nix {};
your_spotify = handleTest ./your_spotify.nix {}; your_spotify = runTest ./your_spotify.nix;
zammad = runTest ./zammad.nix; zammad = runTest ./zammad.nix;
zenohd = runTest ./zenohd.nix; zenohd = runTest ./zenohd.nix;
zeronet-conservancy = runTest ./zeronet-conservancy.nix; zeronet-conservancy = runTest ./zeronet-conservancy.nix;

View File

@@ -1,36 +1,34 @@
import ./make-test-python.nix ( { pkgs, ... }:
{ pkgs, ... }: {
{ name = "your_spotify";
name = "your_spotify"; meta = with pkgs.lib.maintainers; {
meta = with pkgs.lib.maintainers; { maintainers = [ patrickdag ];
maintainers = [ patrickdag ]; };
};
nodes.machine = { nodes.machine = {
services.your_spotify = { services.your_spotify = {
enable = true; enable = true;
spotifySecretFile = pkgs.writeText "spotifySecretFile" "deadbeef"; spotifySecretFile = pkgs.writeText "spotifySecretFile" "deadbeef";
settings = { settings = {
CLIENT_ENDPOINT = "http://localhost"; CLIENT_ENDPOINT = "http://localhost";
API_ENDPOINT = "http://localhost:3000"; API_ENDPOINT = "http://localhost:3000";
SPOTIFY_PUBLIC = "beefdead"; SPOTIFY_PUBLIC = "beefdead";
};
enableLocalDB = true;
nginxVirtualHost = "localhost";
}; };
enableLocalDB = true;
nginxVirtualHost = "localhost";
}; };
};
testScript = '' testScript = ''
machine.wait_for_unit("your_spotify.service") machine.wait_for_unit("your_spotify.service")
machine.wait_for_open_port(3000) machine.wait_for_open_port(3000)
machine.wait_for_open_port(80) machine.wait_for_open_port(80)
out = machine.succeed("curl --fail -X GET 'http://localhost:3000/'") out = machine.succeed("curl --fail -X GET 'http://localhost:3000/'")
assert "Hello !" in out assert "Hello !" in out
out = machine.succeed("curl --fail -X GET 'http://localhost:80/'") out = machine.succeed("curl --fail -X GET 'http://localhost:80/'")
assert "<title>Your Spotify</title>" in out assert "<title>Your Spotify</title>" in out
''; '';
} }
)