2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
|
|
|
name = "clickhouse";
|
2023-03-04 12:14:45 +00:00
|
|
|
meta.maintainers = with pkgs.lib.maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nodes.machine = {
|
2020-04-24 23:36:52 +00:00
|
|
|
services.clickhouse.enable = true;
|
2021-05-20 23:08:51 +00:00
|
|
|
virtualisation.memorySize = 4096;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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.wait_for_unit("clickhouse.service")
|
|
|
|
machine.wait_for_open_port(9000)
|
|
|
|
|
|
|
|
machine.succeed(
|
|
|
|
"cat ${tableDDL} | clickhouse-client"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
"cat ${insertQuery} | clickhouse-client"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
"cat ${selectQuery} | clickhouse-client | grep foo"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
})
|