Unverified Commit c4e186c3 authored by nixpkgs-ci[bot]'s avatar nixpkgs-ci[bot] Committed by GitHub
Browse files

Merge master into staging-next

parents abd845f1 9c1f9dde
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -26,7 +26,10 @@ module.exports = async ({ github, context, core, dry }) => {
    // be detected, no maintainers pinged.
    // We can just check the temporary merge commit, and if it's empty the PR can safely be
    // closed - there are no further changes.
    if (pull_request.merge_commit_sha) {
    // We only do this for PRs, which are non-empty to start with. This avoids closing PRs
    // which have been created with an empty commit for notification purposes, for example
    // the yearly election notification for voters.
    if (pull_request.merge_commit_sha && pull_request.changed_files > 0) {
      const commit = (
        await github.rest.repos.getCommit({
          ...context.repo,
+1 −0
Original line number Diff line number Diff line
@@ -717,6 +717,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")
    '';
}
+1 −0
Original line number Diff line number Diff line
@@ -8,4 +8,5 @@
  prometheus-pair = runTest ./prometheus-pair.nix;
  pushgateway = runTest ./pushgateway.nix;
  remote-write = runTest ./remote-write.nix;
  ui = runTest ./ui.nix;
}
+86 −0
Original line number Diff line number Diff line
{ lib, pkgs, ... }:

{
  name = "prometheus-ui";

  nodes = {
    browser =
      { config, pkgs, ... }:
      {
        environment.systemPackages =
          let
            prometheusSeleniumScript =
              pkgs.writers.writePython3Bin "prometheus-selenium-script"
                {
                  libraries = with pkgs.python3Packages; [ selenium ];
                }
                ''
                  from selenium import webdriver
                  from selenium.webdriver.common.by import By
                  from selenium.webdriver.firefox.options import Options
                  from selenium.webdriver.support.ui import WebDriverWait

                  options = Options()
                  options.add_argument("--headless")
                  service = webdriver.FirefoxService(executable_path="${lib.getExe pkgs.geckodriver}")  # noqa: E501

                  driver = webdriver.Firefox(options=options, service=service)
                  driver.implicitly_wait(10)
                  driver.get("http://prometheus:9090/")

                  wait = WebDriverWait(driver, 60)

                  assert len(driver.find_elements(By.CLASS_NAME, "mantine-AppShell-header")) > 0  # noqa: E501
                  assert len(driver.find_elements(By.CLASS_NAME, "mantine-AppShell-main")) > 0  # noqa: E501

                  driver.close()
                '';
          in
          with pkgs;
          [
            curl
            firefox-unwrapped
            geckodriver
            prometheusSeleniumScript
          ];
      };

    prometheus =
      { config, pkgs, ... }:
      {
        networking.firewall.allowedTCPPorts = [ config.services.prometheus.port ];

        services.prometheus = {
          enable = true;
          globalConfig.scrape_interval = "2s";
          scrapeConfigs = [
            {
              job_name = "prometheus";
              static_configs = [
                {
                  targets = [
                    "prometheus1:${toString config.services.prometheus.port}"
                    "prometheus2:${toString config.services.prometheus.port}"
                  ];
                }
              ];
            }
          ];
        };
      };
  };

  testScript = ''
    prometheus.wait_for_unit("prometheus")
    prometheus.wait_for_open_port(9090)
    prometheus.wait_until_succeeds("curl -sSf http://localhost:9090/-/healthy")

    browser.systemctl("start network-online.target")
    browser.wait_for_unit("network-online.target")

    browser.succeed("curl -kLs http://prometheus:9090/query | grep 'Prometheus Time Series Collection and Processing Server'")

    # Ensure the application is actually rendered by the Javascript
    browser.succeed("PYTHONUNBUFFERED=1 prometheus-selenium-script")
  '';
}
Loading