mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
spark: add passthru test
This commit is contained in:
parent
fc7aceed42
commit
392bc54225
@ -1,28 +1,47 @@
|
|||||||
import ../make-test-python.nix ({...}: {
|
{ pkgs, ... }:
|
||||||
name = "spark";
|
|
||||||
|
|
||||||
nodes = {
|
let
|
||||||
worker = { nodes, pkgs, ... }: {
|
inherit (pkgs) lib;
|
||||||
services.spark.worker = {
|
tests = {
|
||||||
enable = true;
|
default = testsForPackage { sparkPackage = pkgs.spark; };
|
||||||
master = "master:7077";
|
|
||||||
};
|
|
||||||
virtualisation.memorySize = 2048;
|
|
||||||
};
|
|
||||||
master = { config, pkgs, ... }: {
|
|
||||||
services.spark.master = {
|
|
||||||
enable = true;
|
|
||||||
bind = "0.0.0.0";
|
|
||||||
};
|
|
||||||
networking.firewall.allowedTCPPorts = [ 22 7077 8080 ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testsForPackage = args: lib.recurseIntoAttrs {
|
||||||
master.wait_for_unit("spark-master.service")
|
sparkCluster = testSparkCluster args;
|
||||||
worker.wait_for_unit("spark-worker.service")
|
passthru.override = args': testsForPackage (args // args');
|
||||||
worker.copy_from_host( "${./spark_sample.py}", "/spark_sample.py" )
|
};
|
||||||
assert "<title>Spark Master at spark://" in worker.succeed("curl -sSfkL http://master:8080/")
|
testSparkCluster = { sparkPackage, ... }: pkgs.nixosTest ({
|
||||||
worker.succeed("spark-submit --master spark://master:7077 --executor-memory 512m --executor-cores 1 /spark_sample.py")
|
name = "spark";
|
||||||
'';
|
|
||||||
})
|
nodes = {
|
||||||
|
worker = { nodes, pkgs, ... }: {
|
||||||
|
services.spark = {
|
||||||
|
package = sparkPackage;
|
||||||
|
worker = {
|
||||||
|
enable = true;
|
||||||
|
master = "master:7077";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
virtualisation.memorySize = 2048;
|
||||||
|
};
|
||||||
|
master = { config, pkgs, ... }: {
|
||||||
|
services.spark = {
|
||||||
|
package = sparkPackage;
|
||||||
|
master = {
|
||||||
|
enable = true;
|
||||||
|
bind = "0.0.0.0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
networking.firewall.allowedTCPPorts = [ 22 7077 8080 ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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/")
|
||||||
|
worker.succeed("spark-submit --master spark://master:7077 --executor-memory 512m --executor-cores 1 /spark_sample.py")
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
in tests
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
, hadoop
|
, hadoop
|
||||||
, RSupport ? true
|
, RSupport ? true
|
||||||
, R
|
, R
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -60,6 +61,10 @@ let
|
|||||||
ln -s $out/lib/${untarDir}/lib/spark-assembly-*.jar $out/share/java
|
ln -s $out/lib/${untarDir}/lib/spark-assembly-*.jar $out/share/java
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests = nixosTests.spark.default.passthru.override {
|
||||||
|
sparkPackage = finalAttrs.finalPackage;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Apache Spark is a fast and general engine for large-scale data processing";
|
description = "Apache Spark is a fast and general engine for large-scale data processing";
|
||||||
homepage = "https://spark.apache.org/";
|
homepage = "https://spark.apache.org/";
|
||||||
|
Loading…
Reference in New Issue
Block a user