1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/tests/spark/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.6 KiB
Nix
Raw Normal View History

2023-10-22 13:46:20 +01:00
{ pkgs, ... }:
2021-09-17 18:01:01 +01:00
2023-10-22 13:46:20 +01:00
let
inherit (pkgs) lib;
tests = {
default = testsForPackage { sparkPackage = pkgs.spark; };
};
testsForPackage =
args:
lib.recurseIntoAttrs {
sparkCluster = testSparkCluster args;
passthru.override = args': testsForPackage (args // args');
};
testSparkCluster =
{ sparkPackage, ... }:
pkgs.testers.nixosTest ({
2023-10-22 13:46:20 +01:00
name = "spark";
nodes = {
worker =
{ nodes, pkgs, ... }:
{
services.spark = {
package = sparkPackage;
worker = {
enable = true;
master = "master:7077";
};
};
2023-10-22 13:46:20 +01:00
virtualisation.memorySize = 2048;
};
master =
{ config, pkgs, ... }:
{
services.spark = {
package = sparkPackage;
master = {
enable = true;
bind = "0.0.0.0";
};
};
2023-10-22 13:46:20 +01:00
networking.firewall.allowedTCPPorts = [
22
7077
8080
];
2023-10-22 13:46:20 +01:00
};
2021-09-17 18:01:01 +01:00
};
2023-10-22 13:46:20 +01:00
testScript = ''
master.wait_for_unit("spark-master.service")
worker.wait_for_unit("spark-worker.service")
worker.copy_from_host( "${./spark_sample.py}", "/spark_sample.py" )
assert "<title>Spark Master at spark://" in worker.succeed("curl -sSfkL http://master:8080/")
2023-11-04 07:31:45 +00:00
worker.succeed("spark-submit --version | systemd-cat")
2023-10-22 13:46:20 +01:00
worker.succeed("spark-submit --master spark://master:7077 --executor-memory 512m --executor-cores 1 /spark_sample.py")
'';
});
in
tests