Unverified Commit 76b5481d authored by ocfox's avatar ocfox Committed by Sandro Jäckel
Browse files

nixosTests.realm: init

parent 86ce0733
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 {};

nixos/tests/realm.nix

0 → 100644
+39 −0
Original line number Diff line number Diff line
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/")
  '';

})
+8 −0
Original line number Diff line number Diff line
@@ -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";