-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220812 from anpin/feature/promscale-rebase
promscale: 0.10.0 -> 0.17.0
- Loading branch information
Showing
7 changed files
with
142 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# mostly copied from ./timescaledb.nix which was copied from ./postgresql.nix | ||
# as it seemed unapproriate to test additional extensions for postgresql there. | ||
|
||
{ system ? builtins.currentSystem | ||
, config ? { } | ||
, pkgs ? import ../.. { inherit system config; } | ||
}: | ||
|
||
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 USER promscale SUPERUSER PASSWORD 'promscale'; | ||
CREATE DATABASE promscale OWNER promscale; | ||
''; | ||
|
||
make-postgresql-test = postgresql-name: postgresql-package: makeTest { | ||
name = postgresql-name; | ||
meta = with pkgs.lib.maintainers; { | ||
maintainers = [ anpin ]; | ||
}; | ||
|
||
nodes.machine = { config, pkgs, ... }: | ||
{ | ||
services.postgresql = { | ||
enable = true; | ||
package = postgresql-package; | ||
extraPlugins = with postgresql-package.pkgs; [ | ||
timescaledb | ||
promscale_extension | ||
]; | ||
settings = { shared_preload_libraries = "timescaledb, promscale"; }; | ||
}; | ||
environment.systemPackages = with pkgs; [ promscale ]; | ||
}; | ||
|
||
testScript = '' | ||
machine.start() | ||
machine.wait_for_unit("postgresql") | ||
with subtest("Postgresql with extensions timescaledb and promscale is available just after unit start"): | ||
print(machine.succeed("sudo -u postgres psql -f ${test-sql}")) | ||
machine.succeed("sudo -u postgres psql promscale -c 'SHOW shared_preload_libraries;' | grep promscale") | ||
machine.succeed( | ||
"promscale --db.name promscale --db.password promscale --db.user promscale --db.ssl-mode allow --startup.install-extensions --startup.only" | ||
) | ||
machine.succeed("sudo -u postgres psql promscale -c 'SELECT ps_trace.get_trace_retention_period();' | grep '(1 row)'") | ||
machine.shutdown() | ||
''; | ||
}; | ||
#version 15 is not supported yet | ||
applicablePostgresqlVersions = filterAttrs (_: value: versionAtLeast value.version "12" && !(versionAtLeast value.version "15")) postgresql-versions; | ||
in | ||
mapAttrs' | ||
(name: package: { | ||
inherit name; | ||
value = make-postgresql-test name package; | ||
}) | ||
applicablePostgresqlVersions |
17 changes: 0 additions & 17 deletions
17
pkgs/servers/monitoring/prometheus/promscale/0001-remove-jaeger-test-dep.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ lib | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, buildPgxExtension | ||
, postgresql | ||
, stdenv | ||
, nixosTests | ||
}: | ||
|
||
buildPgxExtension rec { | ||
inherit postgresql; | ||
|
||
pname = "promscale_extension"; | ||
version = "0.8.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "timescale"; | ||
repo = "promscale_extension"; | ||
rev = version; | ||
sha256 = "sha256-vyEfQMGguHrHYdBEEmbev29L2uCa/4xL9DpGIniUwfI="; | ||
}; | ||
|
||
cargoSha256 = "sha256-VK9DObkg4trcGUXxxISCd0zqU3vc1Qt6NxqpgKIARCQ="; | ||
|
||
cargoPatches = [ | ||
# there is a duplicate definition in the lock file which fails to build with buildRustPackage | ||
(fetchpatch { | ||
name = "cargo-vendor.patch"; | ||
url = "https://github.com/timescale/promscale_extension/commit/3048bd959430e9abc2c1d5c772ab6b4fc1dc6a95.patch"; | ||
hash = "sha256-xTk4Ml8GN06QlJdrvAdVK21r30ZR/S83y5A5jJPdOw4="; | ||
}) | ||
]; | ||
|
||
preBuild = '' | ||
patchShebangs create-upgrade-symlinks.sh extract-extension-version.sh | ||
## Hack to boostrap the build because some pgx commands require this file. It gets re-generated later. | ||
cp templates/promscale.control ./promscale.control | ||
''; | ||
postInstall = '' | ||
ln -s $out/lib/promscale-${version}.so $out/lib/promscale.so | ||
''; | ||
passthru.tests = { | ||
promscale = nixosTests.promscale; | ||
}; | ||
|
||
# tests take really long | ||
doCheck = false; | ||
|
||
meta = with lib; { | ||
description = "Promscale is an open source observability backend for metrics and traces powered by SQL"; | ||
homepage = "https://github.com/timescale/promscale_extension"; | ||
maintainers = with maintainers; [ anpin ]; | ||
platforms = postgresql.meta.platforms; | ||
license = licenses.unfree; | ||
|
||
# as it needs to be used with timescaledb, simply use the condition from there | ||
broken = versionOlder postgresql.version "12" | ||
|| versionAtLeast postgresql.version "15"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters