From 6e3bf9c2caed7e519eb4e828ef29685592aaaf71 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 1 Nov 2024 20:48:25 +0100 Subject: [PATCH] postgresqlPackages.timescaledb: make passthru.tests work with correct package Same reasoning as commit before. --- nixos/tests/timescaledb.nix | 25 ++++++++----------- .../sql/postgresql/ext/timescaledb.nix | 2 +- .../postgresql/ext/timescaledb_toolkit.nix | 4 +-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/nixos/tests/timescaledb.nix b/nixos/tests/timescaledb.nix index 8ee788daeac70..eb48e6938620a 100644 --- a/nixos/tests/timescaledb.nix +++ b/nixos/tests/timescaledb.nix @@ -1,6 +1,3 @@ -# mostly copied from ./postgresql.nix as it seemed unapproriate to -# test additional extensions for postgresql there. - { system ? builtins.currentSystem , config ? { } , pkgs ? import ../.. { inherit system config; } @@ -10,7 +7,6 @@ with import ../lib/testing-python.nix { inherit system pkgs; }; with pkgs.lib; let - postgresql-versions = import ../../pkgs/servers/sql/postgresql pkgs; test-sql = pkgs.writeText "postgresql-test" '' CREATE EXTENSION timescaledb; CREATE EXTENSION timescaledb_toolkit; @@ -40,9 +36,12 @@ let SELECT average(stats) FROM t; + + SELECT * FROM sth; ''; - make-postgresql-test = postgresql-name: postgresql-package: makeTest { - name = postgresql-name; + + makeTimescaleDbTest = postgresqlPackage: makeTest { + name = "timescaledb-${postgresqlPackage.name}"; meta = with pkgs.lib.maintainers; { maintainers = [ typetetris ]; }; @@ -51,7 +50,7 @@ let { services.postgresql = { enable = true; - package = postgresql-package; + package = postgresqlPackage; extraPlugins = ps: with ps; [ timescaledb timescaledb_toolkit @@ -83,11 +82,9 @@ let ''; }; - applicablePostgresqlVersions = filterAttrs (_: value: versionAtLeast value.version "14") postgresql-versions; in -mapAttrs' - (name: package: { - inherit name; - value = make-postgresql-test name package; - }) - applicablePostgresqlVersions +{ + default = makeTimescaleDbTest pkgs.postgresql; + jit = makeTimescaleDbTest pkgs.postgresql_jit; + passthru.override = p: makeTimescaleDbTest p; +} diff --git a/pkgs/servers/sql/postgresql/ext/timescaledb.nix b/pkgs/servers/sql/postgresql/ext/timescaledb.nix index 60e14e922835b..7ddb887ec8eff 100644 --- a/pkgs/servers/sql/postgresql/ext/timescaledb.nix +++ b/pkgs/servers/sql/postgresql/ext/timescaledb.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { done ''; - passthru.tests = { inherit (nixosTests) timescaledb; }; + passthru.tests = nixosTests.timescaledb.passthru.override postgresql; meta = with lib; { description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space"; diff --git a/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix b/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix index ab414a400d294..7665a4a155781 100644 --- a/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix +++ b/pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix @@ -25,9 +25,7 @@ passthru = { updateScript = nix-update-script { }; - tests = { - timescaledb_toolkit = nixosTests.timescaledb; - }; + tests = nixosTests.timescaledb.passthru.override postgresql; }; # tests take really long