2019-11-09 18:27:26 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
2018-12-19 14:06:53 +00:00
|
|
|
name = "clickhouse";
|
2023-03-03 20:17:25 +00:00
|
|
|
meta.maintainers = with pkgs.lib.maintainers; [ ];
|
2018-12-19 14:06:53 +00:00
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = {
|
2018-12-19 14:06:53 +00:00
|
|
|
services.clickhouse.enable = true;
|
2021-05-18 11:04:37 +01:00
|
|
|
virtualisation.memorySize = 4096;
|
2018-12-19 14:06:53 +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
|
|
|
|
''
|
2019-11-09 18:27:26 +00:00
|
|
|
machine.start()
|
|
|
|
machine.wait_for_unit("clickhouse.service")
|
|
|
|
machine.wait_for_open_port(9000)
|
2018-12-19 14:06:53 +00:00
|
|
|
|
2019-11-09 18:27:26 +00:00
|
|
|
machine.succeed(
|
|
|
|
"cat ${tableDDL} | clickhouse-client"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
"cat ${insertQuery} | clickhouse-client"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
"cat ${selectQuery} | clickhouse-client | grep foo"
|
|
|
|
)
|
2018-12-19 14:06:53 +00:00
|
|
|
'';
|
|
|
|
})
|