Skip to content

Commit

Permalink
postgresqlPackages.timescaledb: make passthru.tests work with correct…
Browse files Browse the repository at this point in the history
… package

Same reasoning as commit before.
  • Loading branch information
wolfgangwalther committed Nov 1, 2024
1 parent 27b25e2 commit 9a6ebf0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
25 changes: 11 additions & 14 deletions nixos/tests/timescaledb.nix
Original file line number Diff line number Diff line change
@@ -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; }
Expand All @@ -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;
Expand Down Expand Up @@ -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 ];
};
Expand All @@ -51,7 +50,7 @@ let
{
services.postgresql = {
enable = true;
package = postgresql-package;
package = postgresqlPackage;
extraPlugins = ps: with ps; [
timescaledb
timescaledb_toolkit
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion pkgs/servers/sql/postgresql/ext/timescaledb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 1 addition & 3 deletions pkgs/servers/sql/postgresql/ext/timescaledb_toolkit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

passthru = {
updateScript = nix-update-script { };
tests = {
timescaledb_toolkit = nixosTests.timescaledb;
};
tests = nixosTests.timescaledb.passthru.override postgresql;
};

# tests take really long
Expand Down

0 comments on commit 9a6ebf0

Please sign in to comment.