mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 13:41:26 +00:00
64d05bbdd2
Although the package itself builds fine, the module fails because it tries to log into a non-existant file in `/var/log` which breaks the service. Patching to default config to log to stdout by default fixes the issue. Additionally this is the better solution as NixOS heavily relies on systemd (and thus journald) for logging. Also, the runtime relies on `/etc/localtime` to start, as it's not required by the module system we set UTC as sensitive default when using the module. To ensure that the service's basic functionality is available, a simple NixOS test has been added.
26 lines
971 B
Nix
26 lines
971 B
Nix
import ./make-test.nix ({ pkgs, ... }: {
|
|
name = "clickhouse";
|
|
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ma27 ];
|
|
|
|
machine = {
|
|
services.clickhouse.enable = true;
|
|
};
|
|
|
|
testScript =
|
|
let
|
|
# work around quote/substitution complexity by Nix, Perl, bash and SQL.
|
|
tableDDL = pkgs.writeText "ddl.sql" "CREATE TABLE `demo` (`value` FixedString(10)) engine = MergeTree PARTITION BY value ORDER BY tuple();";
|
|
insertQuery = pkgs.writeText "insert.sql" "INSERT INTO `demo` (`value`) VALUES ('foo');";
|
|
selectQuery = pkgs.writeText "select.sql" "SELECT * from `demo`";
|
|
in
|
|
''
|
|
$machine->start();
|
|
$machine->waitForUnit("clickhouse.service");
|
|
$machine->waitForOpenPort(9000);
|
|
|
|
$machine->succeed("cat ${tableDDL} | clickhouse-client");
|
|
$machine->succeed("cat ${insertQuery} | clickhouse-client");
|
|
$machine->succeed("cat ${selectQuery} | clickhouse-client | grep foo");
|
|
'';
|
|
})
|