mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
e62c913822
Some of the stuff used to be needed for a project, for others I found alternatives that suited better my needs. Anyways, I don't intend to spend time maintaining these, so no need to keep that.
33 lines
1.0 KiB
Nix
33 lines
1.0 KiB
Nix
import ./make-test-python.nix ({ pkgs, ... }: {
|
|
name = "clickhouse";
|
|
meta.maintainers = with pkgs.lib.maintainers; [ ];
|
|
|
|
nodes.machine = {
|
|
services.clickhouse.enable = true;
|
|
virtualisation.memorySize = 4096;
|
|
};
|
|
|
|
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"
|
|
)
|
|
'';
|
|
})
|