mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixosTests.wakapi: migrate to runTest
This commit is contained in:
parent
6ceacea8c7
commit
c673e7ade9
2 changed files with 56 additions and 58 deletions
|
@ -1295,7 +1295,7 @@ in {
|
||||||
vscodium = discoverTests (import ./vscodium.nix);
|
vscodium = discoverTests (import ./vscodium.nix);
|
||||||
vsftpd = handleTest ./vsftpd.nix {};
|
vsftpd = handleTest ./vsftpd.nix {};
|
||||||
waagent = handleTest ./waagent.nix {};
|
waagent = handleTest ./waagent.nix {};
|
||||||
wakapi = handleTest ./wakapi.nix {};
|
wakapi = runTest ./wakapi.nix;
|
||||||
warzone2100 = handleTest ./warzone2100.nix {};
|
warzone2100 = handleTest ./warzone2100.nix {};
|
||||||
wasabibackend = handleTest ./wasabibackend.nix {};
|
wasabibackend = handleTest ./wasabibackend.nix {};
|
||||||
wastebin = handleTest ./wastebin.nix {};
|
wastebin = handleTest ./wastebin.nix {};
|
||||||
|
|
|
@ -1,67 +1,65 @@
|
||||||
import ./make-test-python.nix (
|
{ lib, ... }:
|
||||||
{ lib, ... }:
|
{
|
||||||
{
|
name = "Wakapi";
|
||||||
name = "Wakapi";
|
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
wakapiPsql = {
|
wakapiPsql = {
|
||||||
services.wakapi = {
|
services.wakapi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
server.port = 3000; # upstream default, set explicitly in case upstream changes it
|
server.port = 3000; # upstream default, set explicitly in case upstream changes it
|
||||||
db = {
|
db = {
|
||||||
dialect = "postgres"; # `createLocally` only supports postgres
|
dialect = "postgres"; # `createLocally` only supports postgres
|
||||||
host = "/run/postgresql";
|
host = "/run/postgresql";
|
||||||
port = 5432; # service will fail if port is not set
|
port = 5432; # service will fail if port is not set
|
||||||
name = "wakapi";
|
name = "wakapi";
|
||||||
user = "wakapi";
|
user = "wakapi";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Automatically create our database
|
|
||||||
database.createLocally = true; # only works with Postgresql for now
|
|
||||||
|
|
||||||
# Created with `cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1`
|
|
||||||
# Prefer passwordSaltFile in production.
|
|
||||||
passwordSalt = "NpqCY7eY7fMoIWYmPx5mAgr6YoSlXSuI";
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
wakapiSqlite = {
|
# Automatically create our database
|
||||||
services.wakapi = {
|
database.createLocally = true; # only works with Postgresql for now
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
server.port = 3001;
|
|
||||||
db = {
|
|
||||||
dialect = "sqlite3";
|
|
||||||
name = "wakapi";
|
|
||||||
user = "wakapi";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
passwordSalt = "NpqCY7eY7fMoIWYmPx5mAgr6YoSlXSuI";
|
# Created with `cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1`
|
||||||
};
|
# Prefer passwordSaltFile in production.
|
||||||
|
passwordSalt = "NpqCY7eY7fMoIWYmPx5mAgr6YoSlXSuI";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Test that service works under both postgresql and sqlite3
|
wakapiSqlite = {
|
||||||
# by starting all machines, and curling the default address.
|
services.wakapi = {
|
||||||
# This is not very comprehensive for a test, but it should
|
enable = true;
|
||||||
# catch very basic mistakes in the module.
|
settings = {
|
||||||
testScript = ''
|
server.port = 3001;
|
||||||
with subtest("Test Wakapi with postgresql backend"):
|
db = {
|
||||||
wakapiPsql.start()
|
dialect = "sqlite3";
|
||||||
wakapiPsql.wait_for_unit("wakapi.service")
|
name = "wakapi";
|
||||||
wakapiPsql.wait_for_open_port(3000)
|
user = "wakapi";
|
||||||
wakapiPsql.succeed("curl --fail http://localhost:3000")
|
};
|
||||||
|
};
|
||||||
|
|
||||||
with subtest("Test Wakapi with sqlite3 backend"):
|
passwordSalt = "NpqCY7eY7fMoIWYmPx5mAgr6YoSlXSuI";
|
||||||
wakapiSqlite.start()
|
};
|
||||||
wakapiSqlite.wait_for_unit("wakapi.service")
|
};
|
||||||
wakapiSqlite.wait_for_open_port(3001)
|
};
|
||||||
wakapiSqlite.succeed("curl --fail http://localhost:3001")
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta.maintainers = [ lib.maintainers.NotAShelf ];
|
# Test that service works under both postgresql and sqlite3
|
||||||
}
|
# by starting all machines, and curling the default address.
|
||||||
)
|
# This is not very comprehensive for a test, but it should
|
||||||
|
# catch very basic mistakes in the module.
|
||||||
|
testScript = ''
|
||||||
|
with subtest("Test Wakapi with postgresql backend"):
|
||||||
|
wakapiPsql.start()
|
||||||
|
wakapiPsql.wait_for_unit("wakapi.service")
|
||||||
|
wakapiPsql.wait_for_open_port(3000)
|
||||||
|
wakapiPsql.succeed("curl --fail http://localhost:3000")
|
||||||
|
|
||||||
|
with subtest("Test Wakapi with sqlite3 backend"):
|
||||||
|
wakapiSqlite.start()
|
||||||
|
wakapiSqlite.wait_for_unit("wakapi.service")
|
||||||
|
wakapiSqlite.wait_for_open_port(3001)
|
||||||
|
wakapiSqlite.succeed("curl --fail http://localhost:3001")
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.maintainers = [ lib.maintainers.NotAShelf ];
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue