0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

postgresqlPackages.apache_datasketches: move nixosTests.apache_datasketches into package

There is no need to fire up a whole VM just to run a two line test of
creating the extension. We can use postgresqlTestExtension for that.
This has the advantage that it runs with postgresqlTestHook, so without
a VM, making it more portable.
This commit is contained in:
Wolfgang Walther 2024-11-01 19:56:51 +01:00
parent 139c546676
commit aded718a98
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1
3 changed files with 10 additions and 34 deletions

View file

@ -815,7 +815,6 @@ in {
postfix-raise-smtpd-tls-security-level = handleTest ./postfix-raise-smtpd-tls-security-level.nix {};
postfixadmin = handleTest ./postfixadmin.nix {};
postgis = handleTest ./postgis.nix {};
apache_datasketches = handleTest ./apache_datasketches.nix {};
postgresql = handleTest ./postgresql.nix {};
postgresql-jit = handleTest ./postgresql-jit.nix {};
postgresql-wal-receiver = handleTest ./postgresql-wal-receiver.nix {};

View file

@ -1,29 +0,0 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "postgis";
meta = with pkgs.lib.maintainers; {
maintainers = [ lsix ]; # TODO: Who's the maintener now?
};
nodes = {
master =
{ pkgs, ... }:
{
services.postgresql = let mypg = pkgs.postgresql_15; in {
enable = true;
package = mypg;
extraPlugins = with mypg.pkgs; [
apache_datasketches
];
};
};
};
testScript = ''
start_all()
master.wait_for_unit("postgresql")
master.sleep(10) # Hopefully this is long enough!!
master.succeed("sudo -u postgres psql -c 'CREATE EXTENSION datasketches;'")
master.succeed("sudo -u postgres psql -c 'SELECT hll_sketch_to_string(hll_sketch_build(1));'")
'';
})

View file

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, postgresql, boost182, nixosTests }:
{ stdenv, lib, fetchFromGitHub, postgresql, boost182, postgresqlTestExtension }:
let
version = "1.7.0";
@ -20,7 +20,7 @@ let
};
in
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "apache_datasketches";
inherit version;
@ -61,7 +61,13 @@ stdenv.mkDerivation {
runHook postInstall
'';
passthru.tests.apache_datasketches = nixosTests.apache_datasketches;
passthru.tests.extension = postgresqlTestExtension {
inherit (finalAttrs) finalPackage;
sql = ''
CREATE EXTENSION datasketches;
SELECT hll_sketch_to_string(hll_sketch_build(1));
'';
};
meta = {
description = "PostgreSQL extension providing approximate algorithms for distinct item counts, quantile estimation and frequent items detection";
@ -75,4 +81,4 @@ stdenv.mkDerivation {
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ mmusnjak ];
};
}
})