Unverified Commit 5f36e60e authored by h7x4's avatar h7x4
Browse files

nixos/tests/hoogle: init

parent 4e4dfda2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -718,6 +718,7 @@ in
  homepage-dashboard = runTest ./homepage-dashboard.nix;
  homer = handleTest ./homer { };
  honk = runTest ./honk.nix;
  hoogle = runTest ./hoogle.nix;
  hostname = handleTest ./hostname.nix { };
  hound = runTest ./hound.nix;
  hub = runTest ./git/hub.nix;

nixos/tests/hoogle.nix

0 → 100644
+31 −0
Original line number Diff line number Diff line
{ lib, ... }:
{
  name = "hoogle";
  meta.maintainers = with lib.maintainers; [ h7x4 ];

  nodes.machine =
    { pkgs, ... }:
    {
      services.hoogle = {
        enable = true;
        packages =
          hp: with hp; [
            arrows
            lens
          ];
      };
    };

  testScript =
    { nodes, ... }:
    let
      cfg = nodes.machine.services.hoogle;
    in
    ''
      machine.wait_for_unit("hoogle.service")
      machine.wait_for_open_port(${toString cfg.port})

      machine.succeed("curl http://${cfg.host}:${toString cfg.port} | grep '<title>Hoogle</title>'")
      machine.succeed("curl 'http://${cfg.host}:${toString cfg.port}?hoogle=>>>' | grep Arrow")
    '';
}
+3 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
  haskellPackages,
  writeText,
  runCommand,
  nixosTests,
}:

# This argument is a function which selects a list of Haskell packages from any
@@ -137,6 +138,8 @@ buildPackages.stdenv.mkDerivation (finalAttrs: {
    '';
  };

  passthru.tests.nixos = nixosTests.hoogle;

  meta = {
    description = "Local Hoogle database";
    platforms = ghc.meta.platforms;