From 63ef6aebef14c23276532a3abdff01fc14b618ee Mon Sep 17 00:00:00 2001 From: Izorkin Date: Sun, 10 Apr 2022 20:41:30 +0300 Subject: [PATCH] nixos/tests: add nifi test --- nixos/tests/all-tests.nix | 1 + nixos/tests/web-apps/nifi.nix | 30 ++++++++++++++++++++++++++ pkgs/servers/web-apps/nifi/default.nix | 6 +++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/web-apps/nifi.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index d9429920f13b..488485064206 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -362,6 +362,7 @@ in nginx-sandbox = handleTestOn ["x86_64-linux"] ./nginx-sandbox.nix {}; nginx-sso = handleTest ./nginx-sso.nix {}; nginx-variants = handleTest ./nginx-variants.nix {}; + nifi = handleTestOn ["x86_64-linux"] ./web-apps/nifi.nix {}; nitter = handleTest ./nitter.nix {}; nix-ld = handleTest ./nix-ld {}; nix-serve = handleTest ./nix-serve.nix {}; diff --git a/nixos/tests/web-apps/nifi.nix b/nixos/tests/web-apps/nifi.nix new file mode 100644 index 000000000000..92f7fa231df3 --- /dev/null +++ b/nixos/tests/web-apps/nifi.nix @@ -0,0 +1,30 @@ +import ../make-test-python.nix ({pkgs, ...}: +{ + name = "nifi"; + meta.maintainers = with pkgs.lib.maintainers; [ izorkin ]; + + nodes = { + nifi = { pkgs, ... }: { + virtualisation = { + memorySize = 2048; + diskSize = 4096; + }; + services.nifi = { + enable = true; + enableHTTPS = false; + }; + }; + }; + + testScript = '' + nifi.start() + + nifi.wait_for_unit("nifi.service") + nifi.wait_for_open_port(8080) + + # Check if NiFi is running + nifi.succeed("curl --fail http://127.0.0.1:8080/nifi/login 2> /dev/null | grep 'NiFi Login'") + + nifi.shutdown() + ''; +}) diff --git a/pkgs/servers/web-apps/nifi/default.nix b/pkgs/servers/web-apps/nifi/default.nix index 43662321f802..f25c1931501e 100644 --- a/pkgs/servers/web-apps/nifi/default.nix +++ b/pkgs/servers/web-apps/nifi/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, makeWrapper, jre8 }: +{ lib, stdenv, fetchurl, makeWrapper, jre8, nixosTests }: stdenv.mkDerivation rec { pname = "nifi"; @@ -27,6 +27,10 @@ stdenv.mkDerivation rec { --replace "#export JAVA_HOME=/usr/java/jdk1.8.0/" "export JAVA_HOME=${jre8}" ''; + passthru = { + tests.nifi = nixosTests.nifi; + }; + meta = with lib; { description = "Easy to use, powerful, and reliable system to process and distribute data"; longDescription = ''