0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

nixosTests.monica: migrate to runTest

Part of #386873
This commit is contained in:
Piotr Kwiecinski 2025-03-29 21:47:04 +01:00
parent 12ab22dac0
commit e90d9be0a3
No known key found for this signature in database
GPG key ID: EC0DE1CB9D5258B4
2 changed files with 32 additions and 34 deletions

View file

@ -725,7 +725,7 @@ in {
mollysocket = handleTest ./mollysocket.nix { };
monado = handleTest ./monado.nix {};
monetdb = handleTest ./monetdb.nix {};
monica = handleTest ./web-apps/monica.nix {};
monica = runTest ./web-apps/monica.nix;
mongodb = runTest ./mongodb.nix;
mongodb-ce = runTest ({ config, ... }: {
imports = [ ./mongodb.nix ];

View file

@ -1,37 +1,35 @@
import ../make-test-python.nix (
{ pkgs, ... }:
let
cert = pkgs.runCommand "selfSignedCerts" { nativeBuildInputs = [ pkgs.openssl ]; } ''
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost' -days 36500
mkdir -p $out
cp key.pem cert.pem $out
'';
in
{
name = "monica";
{ pkgs, ... }:
let
cert = pkgs.runCommand "selfSignedCerts" { nativeBuildInputs = [ pkgs.openssl ]; } ''
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost' -days 36500
mkdir -p $out
cp key.pem cert.pem $out
'';
in
{
name = "monica";
nodes = {
machine =
{ pkgs, ... }:
{
services.monica = {
enable = true;
hostname = "localhost";
appKeyFile = "${pkgs.writeText "keyfile" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}";
nginx = {
forceSSL = true;
sslCertificate = "${cert}/cert.pem";
sslCertificateKey = "${cert}/key.pem";
};
nodes = {
machine =
{ pkgs, ... }:
{
services.monica = {
enable = true;
hostname = "localhost";
appKeyFile = "${pkgs.writeText "keyfile" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}";
nginx = {
forceSSL = true;
sslCertificate = "${cert}/cert.pem";
sslCertificateKey = "${cert}/key.pem";
};
};
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("monica-setup.service")
machine.wait_for_open_port(443)
machine.succeed("curl -k --fail https://localhost", timeout=10)
'';
}
)
testScript = ''
start_all()
machine.wait_for_unit("monica-setup.service")
machine.wait_for_open_port(443)
machine.succeed("curl -k --fail https://localhost", timeout=10)
'';
}