From 5ade08168ac56d453865fd6ebe4c960aa4e59868 Mon Sep 17 00:00:00 2001 From: Alexander Sieg Date: Wed, 17 May 2023 13:10:57 +0200 Subject: [PATCH] outline: add nixos test --- nixos/tests/all-tests.nix | 1 + nixos/tests/outline.nix | 54 +++++++++++++++++++++++ pkgs/servers/web-apps/outline/default.nix | 5 +++ 3 files changed, 60 insertions(+) create mode 100644 nixos/tests/outline.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index af541737e12f..c2519b776b3a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -555,6 +555,7 @@ in { openstack-image-userdata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).userdata or {}; opentabletdriver = handleTest ./opentabletdriver.nix {}; owncast = handleTest ./owncast.nix {}; + outline = handleTest ./outline.nix {}; image-contents = handleTest ./image-contents.nix {}; openvscode-server = handleTest ./openvscode-server.nix {}; orangefs = handleTest ./orangefs.nix {}; diff --git a/nixos/tests/outline.nix b/nixos/tests/outline.nix new file mode 100644 index 000000000000..e45be37f5d3b --- /dev/null +++ b/nixos/tests/outline.nix @@ -0,0 +1,54 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: +let + accessKey = "BKIKJAA5BMMU2RHO6IBB"; + secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12"; + secretKeyFile = pkgs.writeText "outline-secret-key" '' + ${secretKey} + ''; + rootCredentialsFile = pkgs.writeText "minio-credentials-full" '' + MINIO_ROOT_USER=${accessKey} + MINIO_ROOT_PASSWORD=${secretKey} + ''; +in +{ + name = "outline"; + + meta.maintainers = with lib.maintainers; [ xanderio ]; + + nodes = { + outline = { pkgs, config, ... }: { + nixpkgs.config.allowUnfree = true; + environment.systemPackages = [ pkgs.minio-client ]; + services.outline = { + enable = true; + forceHttps = false; + storage = { + inherit accessKey secretKeyFile; + uploadBucketUrl = "http://localhost:9000"; + uploadBucketName = "outline"; + region = config.services.minio.region; + }; + }; + services.minio = { + enable = true; + inherit rootCredentialsFile; + }; + }; + }; + + testScript = + '' + machine.wait_for_unit("minio.service") + machine.wait_for_open_port(9000) + + # Create a test bucket on the server + machine.succeed( + "mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4" + ) + machine.succeed("mc mb minio/outline") + + outline.wait_for_unit("outline.service") + outline.wait_for_open_port(3000) + outline.succeed("curl --fail http://localhost:3000/") + ''; +}) diff --git a/pkgs/servers/web-apps/outline/default.nix b/pkgs/servers/web-apps/outline/default.nix index 6d334e0ec097..b2b8e254cd18 100644 --- a/pkgs/servers/web-apps/outline/default.nix +++ b/pkgs/servers/web-apps/outline/default.nix @@ -5,6 +5,7 @@ , nodejs , yarn , yarn2nix-moretea +, nixosTests }: stdenv.mkDerivation rec { @@ -76,6 +77,10 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru.tests = { + basic-functionality = nixosTests.outline; + }; + meta = with lib; { description = "The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible"; homepage = "https://www.getoutline.com/";