about summary refs log tree commit diff
path: root/pkgs/applications/networking/kubo
diff options
context:
space:
mode:
authorFabián Heredia Montiel <303897+fabianhjr@users.noreply.github.com>2023-10-13 16:13:46 -0600
committerGitHub <noreply@github.com>2023-10-13 16:13:46 -0600
commitd80ad25cf825dc37c90af1f8ebe4aff0e7d0f03d (patch)
tree3a2cd73d984cbcdfd0ec7849f91996399c9adae2 /pkgs/applications/networking/kubo
parent10a2d008cf8eafbf3069b8503a9d9bcbe3be0cad (diff)
parentcf8aa48605d68997be93f69ce853d76449ff68cc (diff)
Merge pull request #259792 from Luflosi/kubo-test-improvements
nixos/tests/kubo: various improvements
Diffstat (limited to 'pkgs/applications/networking/kubo')
-rw-r--r--pkgs/applications/networking/kubo/default.nix6
-rw-r--r--pkgs/applications/networking/kubo/test-repoVersion.nix13
2 files changed, 18 insertions, 1 deletions
diff --git a/pkgs/applications/networking/kubo/default.nix b/pkgs/applications/networking/kubo/default.nix
index 4f57c481cfe16..75c69596ddd57 100644
--- a/pkgs/applications/networking/kubo/default.nix
+++ b/pkgs/applications/networking/kubo/default.nix
@@ -2,6 +2,7 @@
 , buildGoModule
 , fetchurl
 , nixosTests
+, callPackage
 }:
 
 buildGoModule rec {
@@ -29,7 +30,10 @@ buildGoModule rec {
 
   subPackages = [ "cmd/ipfs" ];
 
-  passthru.tests.kubo = nixosTests.kubo;
+  passthru.tests = {
+    inherit (nixosTests) kubo;
+    repoVersion = callPackage ./test-repoVersion.nix {};
+  };
 
   vendorHash = null;
 
diff --git a/pkgs/applications/networking/kubo/test-repoVersion.nix b/pkgs/applications/networking/kubo/test-repoVersion.nix
new file mode 100644
index 0000000000000..25fd8fcfbf43a
--- /dev/null
+++ b/pkgs/applications/networking/kubo/test-repoVersion.nix
@@ -0,0 +1,13 @@
+{ runCommand, kubo }:
+
+runCommand "kubo-test-repoVersion" { } ''
+  export IPFS_PATH="$TMPDIR"
+  "${kubo}/bin/ipfs" init --empty-repo
+  declared_repo_version='${kubo.repoVersion}'
+  actual_repo_version="$(cat "$IPFS_PATH/version")"
+  if [ "$declared_repo_version" != "$actual_repo_version" ]; then
+    echo "kubo.repoVersion is not set correctly. It should be $actual_repo_version but is $declared_repo_version."
+    exit 1
+  fi
+  touch "$out"
+''