about summary refs log tree commit diff
path: root/pkgs/tools/system/skeema
diff options
context:
space:
mode:
authorBerk D. Demir <bdd@mindcast.org>2022-05-01 23:15:08 +0000
committerBerk D. Demir <bdd@mindcast.org>2022-06-01 00:52:20 +0000
commit1b748f081ad7ef034ce6c7438305d9957e771aec (patch)
treef8329ad0f937852b733560c131644b106ea6352e /pkgs/tools/system/skeema
parent17672c8de18503137817b66fe9cd640d652f7f8a (diff)
skeema: Disable tests requiring network & fix deps
- Disable the tests requiring access to gitlab.com.
- Add coreutils to `nativeBuildInputs` for printf and echo binaries.
- Fix hard coded paths to coreutils binaries.

Bug fixed by #173702 runs the previously skipped tests for this
package.
Diffstat (limited to 'pkgs/tools/system/skeema')
-rw-r--r--pkgs/tools/system/skeema/default.nix25
1 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/tools/system/skeema/default.nix b/pkgs/tools/system/skeema/default.nix
index bf1bacede8d07..4d39e47da5912 100644
--- a/pkgs/tools/system/skeema/default.nix
+++ b/pkgs/tools/system/skeema/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, coreutils }:
 
 buildGoModule rec {
   pname = "skeema";
@@ -17,6 +17,29 @@ buildGoModule rec {
 
   ldflags = [ "-s" "-w" ];
 
+  preCheck = ''
+    # Disable tests requiring network access to gitlab.com
+    buildFlagsArray+=("-run" "[^(Test(ParseDir(Symlinks|))|DirRelPath)]")
+
+    # Fix tests expecting /usr/bin/printf and /bin/echo
+    substituteInPlace skeema_cmd_test.go \
+      --replace /usr/bin/printf "${coreutils}/bin/printf"
+
+    substituteInPlace internal/fs/dir_test.go \
+      --replace /bin/echo "${coreutils}/bin/echo" \
+      --replace /usr/bin/printf "${coreutils}/bin/printf"
+
+    substituteInPlace internal/applier/ddlstatement_test.go \
+      --replace /bin/echo "${coreutils}/bin/echo"
+
+    substituteInPlace internal/util/shellout_unix_test.go \
+      --replace /bin/echo "${coreutils}/bin/echo" \
+      --replace /usr/bin/printf "${coreutils}/bin/printf"
+
+    substituteInPlace internal/util/shellout_unix_test.go \
+      --replace /bin/echo "${coreutils}/bin/echo"
+  '';
+
   checkFlags = [ "-short" ];
 
   meta = with lib; {