Merge pull request #73934 from flokli/nixos-test-port-cockroachdb
nixosTests.cockroachdb: port to python
This commit is contained in:
commit
f882896cc8
@ -92,6 +92,11 @@ in
|
|||||||
|
|
||||||
systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; };
|
systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; };
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${stateDir} 0755 chrony chrony - -"
|
||||||
|
"f ${keyFile} 0640 chrony chrony -"
|
||||||
|
];
|
||||||
|
|
||||||
systemd.services.chronyd =
|
systemd.services.chronyd =
|
||||||
{ description = "chrony NTP daemon";
|
{ description = "chrony NTP daemon";
|
||||||
|
|
||||||
@ -103,13 +108,6 @@ in
|
|||||||
|
|
||||||
path = [ pkgs.chrony ];
|
path = [ pkgs.chrony ];
|
||||||
|
|
||||||
preStart = ''
|
|
||||||
mkdir -m 0755 -p ${stateDir}
|
|
||||||
touch ${keyFile}
|
|
||||||
chmod 0640 ${keyFile}
|
|
||||||
chown chrony:chrony ${stateDir} ${keyFile}
|
|
||||||
'';
|
|
||||||
|
|
||||||
unitConfig.ConditionCapability = "CAP_SYS_TIME";
|
unitConfig.ConditionCapability = "CAP_SYS_TIME";
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ Type = "simple";
|
{ Type = "simple";
|
||||||
@ -118,7 +116,7 @@ in
|
|||||||
ProtectHome = "yes";
|
ProtectHome = "yes";
|
||||||
ProtectSystem = "full";
|
ProtectSystem = "full";
|
||||||
PrivateTmp = "yes";
|
PrivateTmp = "yes";
|
||||||
|
StateDirectory = "chrony";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -51,6 +51,7 @@ in
|
|||||||
cloud-init = handleTest ./cloud-init.nix {};
|
cloud-init = handleTest ./cloud-init.nix {};
|
||||||
codimd = handleTest ./codimd.nix {};
|
codimd = handleTest ./codimd.nix {};
|
||||||
consul = handleTest ./consul.nix {};
|
consul = handleTest ./consul.nix {};
|
||||||
|
cockroachdb = handleTestOn ["x86_64-linux"] ./cockroachdb.nix {};
|
||||||
containers-bridge = handleTest ./containers-bridge.nix {};
|
containers-bridge = handleTest ./containers-bridge.nix {};
|
||||||
containers-ephemeral = handleTest ./containers-ephemeral.nix {};
|
containers-ephemeral = handleTest ./containers-ephemeral.nix {};
|
||||||
containers-extra_veth = handleTest ./containers-extra_veth.nix {};
|
containers-extra_veth = handleTest ./containers-extra_veth.nix {};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# This performs a full 'end-to-end' test of a multi-node CockroachDB cluster
|
# This performs a full 'end-to-end' test of a multi-node CockroachDB cluster
|
||||||
# using the built-in 'cockroach workload' command, to simulate a semi-realistic
|
# using the built-in 'cockroach workload' command, to simulate a semi-realistic
|
||||||
# test load. It generally takes anywhere from 3-5 minutes to run and 1-2GB of
|
# test load. It generally takes anywhere from 3-5 minutes to run and 1-2GB of
|
||||||
# RAM (though each of 3 workers gets 1GB allocated)
|
# RAM (though each of 3 workers gets 2GB allocated)
|
||||||
#
|
#
|
||||||
# CockroachDB requires synchronized system clocks within a small error window
|
# CockroachDB requires synchronized system clocks within a small error window
|
||||||
# (~500ms by default) on each node in order to maintain a multi-node cluster.
|
# (~500ms by default) on each node in order to maintain a multi-node cluster.
|
||||||
@ -55,7 +55,7 @@ let
|
|||||||
|
|
||||||
{
|
{
|
||||||
# Bank/TPC-C benchmarks take some memory to complete
|
# Bank/TPC-C benchmarks take some memory to complete
|
||||||
virtualisation.memorySize = 1024;
|
virtualisation.memorySize = 2048;
|
||||||
|
|
||||||
# Install the KVM PTP "Virtualized Clock" driver. This allows a /dev/ptp0
|
# Install the KVM PTP "Virtualized Clock" driver. This allows a /dev/ptp0
|
||||||
# device to appear as a reference clock, synchronized to the host clock.
|
# device to appear as a reference clock, synchronized to the host clock.
|
||||||
@ -88,6 +88,8 @@ let
|
|||||||
services.cockroachdb.listen.address = myAddr;
|
services.cockroachdb.listen.address = myAddr;
|
||||||
services.cockroachdb.join = lib.mkIf (joinNode != null) joinNode;
|
services.cockroachdb.join = lib.mkIf (joinNode != null) joinNode;
|
||||||
|
|
||||||
|
systemd.services.chronyd.unitConfig.ConditionPathExists = "/dev/ptp0";
|
||||||
|
|
||||||
# Hold startup until Chrony has performed its first measurement (which
|
# Hold startup until Chrony has performed its first measurement (which
|
||||||
# will probably result in a full timeskip, thanks to makestep)
|
# will probably result in a full timeskip, thanks to makestep)
|
||||||
systemd.services.cockroachdb.preStart = ''
|
systemd.services.cockroachdb.preStart = ''
|
||||||
@ -95,7 +97,7 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in import ./make-test.nix ({ pkgs, ...} : {
|
in import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
name = "cockroachdb";
|
name = "cockroachdb";
|
||||||
meta.maintainers = with pkgs.stdenv.lib.maintainers;
|
meta.maintainers = with pkgs.stdenv.lib.maintainers;
|
||||||
[ thoughtpolice ];
|
[ thoughtpolice ];
|
||||||
@ -110,17 +112,13 @@ in import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
# there's otherwise no way to guarantee that node1 will start before the others try
|
# there's otherwise no way to guarantee that node1 will start before the others try
|
||||||
# to join it.
|
# to join it.
|
||||||
testScript = ''
|
testScript = ''
|
||||||
$node1->start;
|
for node in node1, node2, node3:
|
||||||
$node1->waitForUnit("cockroachdb");
|
node.start()
|
||||||
|
node.wait_for_unit("cockroachdb")
|
||||||
$node2->start;
|
node1.succeed(
|
||||||
$node2->waitForUnit("cockroachdb");
|
"cockroach sql --host=192.168.1.1 --insecure -e 'SHOW ALL CLUSTER SETTINGS' 2>&1",
|
||||||
|
"cockroach workload init bank 'postgresql://root@192.168.1.1:26257?sslmode=disable'",
|
||||||
$node3->start;
|
"cockroach workload run bank --duration=1m 'postgresql://root@192.168.1.1:26257?sslmode=disable'",
|
||||||
$node3->waitForUnit("cockroachdb");
|
)
|
||||||
|
|
||||||
$node1->mustSucceed("cockroach sql --host=192.168.1.1 --insecure -e 'SHOW ALL CLUSTER SETTINGS' 2>&1");
|
|
||||||
$node1->mustSucceed("cockroach workload init bank 'postgresql://root\@192.168.1.1:26257?sslmode=disable'");
|
|
||||||
$node1->mustSucceed("cockroach workload run bank --duration=1m 'postgresql://root\@192.168.1.1:26257?sslmode=disable'");
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user