about summary refs log tree commit diff
path: root/pkgs/applications/networking/cloudflared/tests.nix
diff options
context:
space:
mode:
authorPiper McCorkle <contact@piperswe.me>2022-09-04 19:33:21 -0500
committerPiper McCorkle <contact@piperswe.me>2022-12-13 18:31:54 -0600
commit91ccc070208d5a27df308dad2e751209e69d9aba (patch)
tree0437ae7fe0aa0c44ee2b45cf2b522deffdd61adc /pkgs/applications/networking/cloudflared/tests.nix
parente3e35e40579a9ac0ed8493168c2b66f5791e4bb7 (diff)
cloudflared: 2022.8.2 -> 2022.11.1, add tests and additional platforms
Diffstat (limited to 'pkgs/applications/networking/cloudflared/tests.nix')
-rw-r--r--pkgs/applications/networking/cloudflared/tests.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/applications/networking/cloudflared/tests.nix b/pkgs/applications/networking/cloudflared/tests.nix
new file mode 100644
index 0000000000000..8314e84075fd2
--- /dev/null
+++ b/pkgs/applications/networking/cloudflared/tests.nix
@@ -0,0 +1,44 @@
+{ version, lib, stdenv, pkgsCross, testers, cloudflared, runCommand, wine, wine64 }:
+
+let
+  inherit (stdenv) buildPlatform;
+in
+{
+  version = testers.testVersion {
+    package = cloudflared;
+    command = "cloudflared help";
+  };
+  refuses-to-autoupdate = runCommand "cloudflared-${version}-refuses-to-autoupdate"
+    {
+      nativeBuildInputs = [ cloudflared ];
+    } ''
+    set -e
+    cloudflared update 2>&1 | tee output.txt
+    if ! grep "cloudflared was installed by nixpkgs" output.txt
+    then
+      echo "cloudflared's output didn't contain the package manager name"
+      exit 1
+    fi
+    mkdir $out
+  '';
+} // lib.optionalAttrs (buildPlatform.isLinux && (buildPlatform.isi686 || buildPlatform.isx86_64)) {
+  runs-through-wine = runCommand "cloudflared-${version}-runs-through-wine"
+    {
+      nativeBuildInputs = [ wine ];
+      exe = "${pkgsCross.mingw32.cloudflared}/bin/cloudflared.exe";
+    } ''
+    export HOME="$(mktemp -d)"
+    wine $exe help
+    mkdir $out
+  '';
+} // lib.optionalAttrs (buildPlatform.isLinux && buildPlatform.isx86_64) {
+  runs-through-wine64 = runCommand "cloudflared-${version}-runs-through-wine64"
+    {
+      nativeBuildInputs = [ wine64 ];
+      exe = "${pkgsCross.mingwW64.cloudflared}/bin/cloudflared.exe";
+    } ''
+    export HOME="$(mktemp -d)"
+    wine64 $exe help
+    mkdir $out
+  '';
+}