Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Emanuele Peruffo 2017-04-07 13:41:37 +02:00
commit 2dbb3c85d0
4 changed files with 58 additions and 28 deletions

View File

@ -21,6 +21,7 @@ let
use-ipv6=${if ipv6 then "yes" else "no"} use-ipv6=${if ipv6 then "yes" else "no"}
${optionalString (interfaces!=null) "allow-interfaces=${concatStringsSep "," interfaces}"} ${optionalString (interfaces!=null) "allow-interfaces=${concatStringsSep "," interfaces}"}
${optionalString (domainName!=null) "domain-name=${domainName}"} ${optionalString (domainName!=null) "domain-name=${domainName}"}
allow-point-to-point=${if allowPointToPoint then "yes" else "no"}
[wide-area] [wide-area]
enable-wide-area=${if wideArea then "yes" else "no"} enable-wide-area=${if wideArea then "yes" else "no"}
@ -98,6 +99,15 @@ in
''; '';
}; };
allowPointToPoint = mkOption {
default = false;
description= ''
Whether to use POINTTOPOINT interfaces. Might make mDNS unreliable due to usually large
latencies with such links and opens a potential security hole by allowing mDNS access from Internet
connections. Use with care and YMMV!
'';
};
wideArea = mkOption { wideArea = mkOption {
default = true; default = true;
description = ''Whether to enable wide-area service discovery.''; description = ''Whether to enable wide-area service discovery.'';

View File

@ -288,8 +288,8 @@ in rec {
tests.pam-oath-login = callTest tests/pam-oath-login.nix {}; tests.pam-oath-login = callTest tests/pam-oath-login.nix {};
#tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); #tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; });
tests.peerflix = callTest tests/peerflix.nix {}; tests.peerflix = callTest tests/peerflix.nix {};
tests.postgresql = callSubTests tests/postgresql.nix {};
tests.pgjwt = callTest tests/pgjwt.nix {}; tests.pgjwt = callTest tests/pgjwt.nix {};
tests.postgresql = callTest tests/postgresql.nix {};
tests.printing = callTest tests/printing.nix {}; tests.printing = callTest tests/printing.nix {};
tests.proxy = callTest tests/proxy.nix {}; tests.proxy = callTest tests/proxy.nix {};
tests.pumpio = callTest tests/pump.io.nix {}; tests.pumpio = callTest tests/pump.io.nix {};

View File

@ -1,26 +1,46 @@
import ./make-test.nix ({ pkgs, ...} : { { system ? builtins.currentSystem }:
name = "postgresql"; with import ../lib/testing.nix { inherit system; };
with pkgs.lib;
let
postgresql-versions = pkgs.callPackages ../../pkgs/servers/sql/postgresql { };
test-sql = pkgs.writeText "postgresql-test" ''
CREATE EXTENSION pgcrypto; -- just to check if lib loading works
CREATE TABLE sth (
id int
);
INSERT INTO sth (id) VALUES (1);
INSERT INTO sth (id) VALUES (1);
INSERT INTO sth (id) VALUES (1);
INSERT INTO sth (id) VALUES (1);
INSERT INTO sth (id) VALUES (1);
'';
make-postgresql-test = postgresql-name: postgresql-package: {
name = postgresql-name;
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ zagy ]; maintainers = [ zagy ];
}; };
nodes = { machine = {pkgs, config, ...}:
master =
{ pkgs, config, ... }:
{ {
services.postgresql.package=postgresql-package;
services.postgresql.enable = true; services.postgresql.enable = true;
services.postgresql.initialScript = pkgs.writeText "postgresql-init.sql"
''
CREATE ROLE postgres WITH superuser login createdb;
'';
};
}; };
testScript = '' testScript = ''
startAll; $machine->start;
$master->waitForUnit("postgresql"); $machine->waitForUnit("postgresql");
$master->sleep(10); # Hopefully this is long enough!! # postgresql should be available just after unit start
$master->succeed("echo 'select 1' | sudo -u postgres psql"); $machine->succeed("cat ${test-sql} | psql postgres");
$machine->shutdown; # make sure that postgresql survive restart (bug #1735)
sleep(2);
$machine->start;
$machine->waitForUnit("postgresql");
$machine->fail('test $(psql postgres -tAc "SELECT * FROM sth;"|wc -l) -eq 3');
$machine->succeed('test $(psql postgres -tAc "SELECT * FROM sth;"|wc -l) -eq 5');
$machine->fail('test $(psql postgres -tAc "SELECT * FROM sth;"|wc -l) -eq 4');
$machine->shutdown;
''; '';
})
};
in
mapAttrs' (p-name: p-package: {name=p-name; value=make-postgresql-test p-name p-package;}) postgresql-versions

View File

@ -1,13 +1,13 @@
{ stdenv, fetchurl, unzip, jre }: { stdenv, fetchurl, unzip, jre }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "0.6.7"; version = "0.6.8";
baseName = "scalafmt"; baseName = "scalafmt";
name = "${baseName}-${version}"; name = "${baseName}-${version}";
src = fetchurl { src = fetchurl {
url = "https://github.com/scalameta/scalafmt/releases/download/v${version}/${baseName}.tar.gz"; url = "https://github.com/scalameta/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
sha256 = "122x4a5x8024s7qqqs7vx8kz1x18q2l6alcvpzvsqkc304ybhfmh"; sha256 = "1iaanrxk5lhxx1zj9gbxzgqbnyy1azfrab984mga7di5z1hs02s2";
}; };
unpackPhase = "tar xvzf $src"; unpackPhase = "tar xvzf $src";