From af4c4157f5c05ea616602292ade9730bf2db1903 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Fri, 13 Mar 2026 13:32:30 -0500 Subject: [PATCH] nix: remove uneeded slocat slocat was introduced to test pipeline mode (see https://github.com/PostgREST/postgrest/pull/2682), but pipeline mode was not merged https://github.com/PostgREST/postgrest/pull/2707. So it's really not needed on the loadtests. --- default.nix | 1 - nix/overlays/default.nix | 1 - nix/overlays/slocat.nix | 13 ------- nix/tools/loadtest.nix | 2 - nix/tools/withTools.nix | 80 +--------------------------------------- 5 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 nix/overlays/slocat.nix diff --git a/default.nix b/default.nix index e9c335377..09af0f1d0 100644 --- a/default.nix +++ b/default.nix @@ -44,7 +44,6 @@ let allOverlays.checked-shell-script allOverlays.gitignore (allOverlays.haskell-packages { inherit compiler; }) - allOverlays.slocat ]; # Evaluated expression of the Nixpkgs repository. diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 4a5f88643..f8d00c1ae 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -3,5 +3,4 @@ checked-shell-script = import ./checked-shell-script; gitignore = import ./gitignore.nix; haskell-packages = import ./haskell-packages.nix; - slocat = import ./slocat.nix; } diff --git a/nix/overlays/slocat.nix b/nix/overlays/slocat.nix deleted file mode 100644 index 42f89fc34..000000000 --- a/nix/overlays/slocat.nix +++ /dev/null @@ -1,13 +0,0 @@ -_: prev: -{ - slocat = prev.buildGoModule { - name = "slocat"; - src = prev.fetchFromGitHub { - owner = "robx"; - repo = "slocat"; - rev = "52e7512c6029fd00483e41ccce260a3b4b9b3b64"; - sha256 = "sha256-qn6luuh5wqREu3s8RfuMCP5PKdS2WdwPrujRYTpfzQ8="; - }; - vendorHash = null; - }; -} diff --git a/nix/tools/loadtest.nix b/nix/tools/loadtest.nix index 90e139783..47b276303 100644 --- a/nix/tools/loadtest.nix +++ b/nix/tools/loadtest.nix @@ -140,9 +140,7 @@ let mixed) # shellcheck disable=SC2145 ${withTools.withPg} -f "$_arg_testdir"/fixtures.sql \ - ${withTools.withSlowPg} \ ${withTools.withPgrst} -m "$_arg_monitor" \ - ${withTools.withSlowPgrst} \ sh -c "cd \"$_arg_testdir\" && \ ${runner} -targets targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\"" ;; diff --git a/nix/tools/withTools.nix b/nix/tools/withTools.nix index a63e8f1fb..488bb6a1f 100644 --- a/nix/tools/withTools.nix +++ b/nix/tools/withTools.nix @@ -6,7 +6,6 @@ , postgresqlVersions , postgrest , python3Packages -, slocat , writeText , writers }: @@ -185,81 +184,6 @@ let withPg = withTmpDb (builtins.head postgresqlVersions); - withSlowPg = - checkedShellScript - { - name = "postgrest-with-slow-pg"; - docs = "Run the given command with simulated high latency postgresql"; - args = - [ - "ARG_POSITIONAL_SINGLE([command], [Command to run])" - "ARG_LEFTOVERS([command arguments])" - "ARG_USE_ENV([PGHOST], [], [PG host (socket name)])" - "ARG_USE_ENV([PGDELAY], [0ms], [extra PG latency (duration)])" - ]; - positionalCompletion = "_command"; - workingDir = "/"; - redirectTixFiles = false; - withTmpDir = true; - } - '' - delay="''${PGDELAY:-0ms}" - echo "delaying data to/from postgres by $delay" - - REALPGHOST="$PGHOST" - export PGHOST="$tmpdir/socket" - mkdir -p "$PGHOST" - - ${slocat}/bin/slocat -delay "$delay" -src "$PGHOST/.s.PGSQL.5432" -dst "$REALPGHOST/.s.PGSQL.5432" & - SLOCAT_PID=$! - # shellcheck disable=SC2317 - stop_slocat() { - kill "$SLOCAT_PID" || true - wait "$SLOCAT_PID" || true - } - trap stop_slocat EXIT - sleep 1 # should wait for socket file to appear instead - - ("$_arg_command" "''${_arg_leftovers[@]}") - ''; - - withSlowPgrst = - checkedShellScript - { - name = "postgrest-with-slow-postgrest"; - docs = "Run the given command with simulated high latency postgrest"; - args = - [ - "ARG_POSITIONAL_SINGLE([command], [Command to run])" - "ARG_LEFTOVERS([command arguments])" - "ARG_USE_ENV([PGRST_SERVER_UNIX_SOCKET], [], [PostgREST host (socket name)])" - "ARG_USE_ENV([PGRST_DELAY], [0ms], [extra PostgREST latency (duration)])" - ]; - positionalCompletion = "_command"; - workingDir = "/"; - redirectTixFiles = false; - withTmpDir = true; - } - '' - delay="''${PGRST_DELAY:-0ms}" - echo "delaying data to/from PostgREST by $delay" - - REAL_PGRST_SERVER_UNIX_SOCKET="$PGRST_SERVER_UNIX_SOCKET" - export PGRST_SERVER_UNIX_SOCKET="$tmpdir/postgrest.socket" - - ${slocat}/bin/slocat -delay "$delay" -src "$PGRST_SERVER_UNIX_SOCKET" -dst "$REAL_PGRST_SERVER_UNIX_SOCKET" & - SLOCAT_PID=$! - # shellcheck disable=SC2317 - stop_slocat() { - kill "$SLOCAT_PID" || true - wait "$SLOCAT_PID" || true - } - trap stop_slocat EXIT - sleep 1 # should wait for socket file to appear instead - - ("$_arg_command" "''${_arg_leftovers[@]}") - ''; - withGit = let name = "postgrest-with-git"; @@ -455,9 +379,7 @@ buildToolbox inherit withGit withPgAll - withPgrst - withSlowPg - withSlowPgrst; + withPgrst; } // builtins.listToAttrs ( # Create a `postgrest-with-pg-` for each PostgreSQL version builtins.map (pg: { inherit (pg) name; value = withTmpDb pg; }) postgresqlVersions