nixosTests.realm: init

This commit is contained in:
ocfox 2024-01-28 12:56:32 +08:00 committed by Sandro Jäckel
parent 86ce0733d2
commit 76b5481df7
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
3 changed files with 48 additions and 0 deletions

View File

@ -811,6 +811,7 @@ in {
ragnarwm = handleTest ./ragnarwm.nix {};
rasdaemon = handleTest ./rasdaemon.nix {};
readarr = handleTest ./readarr.nix {};
realm = handleTest ./realm.nix {};
redis = handleTest ./redis.nix {};
redlib = handleTest ./redlib.nix {};
redmine = handleTest ./redmine.nix {};

39
nixos/tests/realm.nix Normal file
View File

@ -0,0 +1,39 @@
import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "realm";
meta = {
maintainers = with lib.maintainers; [ ocfox ];
};
nodes.machine = { pkgs, ... }: {
services.nginx = {
enable = true;
statusPage = true;
};
# realm need DNS resolv server to run or use config.dns.nameserver
services.resolved.enable = true;
services.realm = {
enable = true;
config = {
endpoints = [
{
listen = "0.0.0.0:1000";
remote = "127.0.0.1:80";
}
];
};
};
};
testScript = ''
machine.wait_for_unit("nginx.service")
machine.wait_for_unit("realm.service")
machine.wait_for_open_port(80)
machine.wait_for_open_port(1000)
machine.succeed("curl --fail http://localhost:1000/")
'';
})

View File

@ -3,6 +3,8 @@
, fetchFromGitHub
, stdenv
, darwin
, nix-update-script
, nixosTests
}:
rustPlatform.buildRustPackage rec {
@ -24,6 +26,12 @@ rustPlatform.buildRustPackage rec {
env.RUSTC_BOOTSTRAP = 1;
passthru = {
updateScript = nix-update-script { };
tests = { inherit (nixosTests) realm; };
};
meta = with lib; {
description = "A simple, high performance relay server written in rust";
homepage = "https://github.com/zhboner/realm";