tests/nextflow: init

This commit is contained in:
Rolf Schröder 2024-09-24 05:57:38 +02:00 committed by Doron Behar
parent e7dac85a81
commit 8d15ee11ac
3 changed files with 63 additions and 0 deletions

View File

@ -658,6 +658,7 @@ in {
# TODO: put in networking.nix after the test becomes more complete # TODO: put in networking.nix after the test becomes more complete
networkingProxy = handleTest ./networking-proxy.nix {}; networkingProxy = handleTest ./networking-proxy.nix {};
nextcloud = handleTest ./nextcloud {}; nextcloud = handleTest ./nextcloud {};
nextflow = handleTest ./nextflow.nix {};
nextjs-ollama-llm-ui = runTest ./web-apps/nextjs-ollama-llm-ui.nix; nextjs-ollama-llm-ui = runTest ./web-apps/nextjs-ollama-llm-ui.nix;
nexus = handleTest ./nexus.nix {}; nexus = handleTest ./nexus.nix {};
# TODO: Test nfsv3 + Kerberos # TODO: Test nfsv3 + Kerberos

60
nixos/tests/nextflow.nix Normal file
View File

@ -0,0 +1,60 @@
import ./make-test-python.nix (
{ pkgs, ... }:
let
bash = pkgs.dockerTools.pullImage {
imageName = "quay.io/nextflow/bash";
imageDigest = "sha256:bea0e244b7c5367b2b0de687e7d28f692013aa18970941c7dd184450125163ac";
sha256 = "161s9f24njjx87qrwq0c9nmnwvyc6iblcxka7hirw78lm7i9x4w5";
finalImageName = "quay.io/nextflow/bash";
};
hello = pkgs.stdenv.mkDerivation {
name = "nextflow-hello";
src = pkgs.fetchFromGitHub {
owner = "nextflow-io";
repo = "hello";
rev = "afff16a9b45c8e8a4f5a3743780ac13a541762f8";
hash = "sha256-c8FirHc+J5Y439g0BdHxRtXVrOAzIrGEKA0m1mp9b/U=";
};
installPhase = ''
cp -r $src $out
'';
};
run-nextflow-pipeline = pkgs.writeShellApplication {
name = "run-nextflow-pipeline";
runtimeInputs = [ pkgs.nextflow ];
text = ''
export NXF_OFFLINE=true
for b in false true; do
echo "docker.enabled = $b" > nextflow.config
cat nextflow.config
nextflow run -ansi-log false ${hello}
done
'';
};
in
{
name = "nextflow";
nodes.machine =
{ ... }:
{
environment.systemPackages = [
run-nextflow-pipeline
pkgs.nextflow
];
virtualisation = {
docker.enable = true;
};
};
testScript =
{ nodes, ... }:
''
start_all()
machine.wait_for_unit("docker.service")
machine.succeed("docker load < ${bash}")
machine.succeed("run-nextflow-pipeline >&2")
'';
}
)

View File

@ -12,6 +12,7 @@
coreutils, coreutils,
bash, bash,
testers, testers,
nixosTests,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "nextflow"; pname = "nextflow";
@ -83,6 +84,7 @@ stdenv.mkDerivation (finalAttrs: {
--set JAVA_HOME ${openjdk.home} --set JAVA_HOME ${openjdk.home}
''; '';
passthru.tests.default = nixosTests.nextflow;
# versionCheckHook doesn't work as of 2024-09-23. # versionCheckHook doesn't work as of 2024-09-23.
# See https://github.com/NixOS/nixpkgs/pull/339197#issuecomment-2363495060 # See https://github.com/NixOS/nixpkgs/pull/339197#issuecomment-2363495060
passthru.tests.version = testers.testVersion { passthru.tests.version = testers.testVersion {