···
1
+
import ./make-test.nix ({ pkgs, ... }:
2
+
let mungekey = "mungeverryweakkeybuteasytointegratoinatest";
4
+
client.enable = true;
5
+
controlMachine = "control";
8
+
NodeName=node[1-3] CPUs=1 State=UNKNOWN
10
+
partitionName = "debug Nodes=node[1-3] Default=YES MaxTime=INFINITE State=UP";
18
+
{ config, pkgs, ...}:
20
+
# TODO slrumd port and slurmctld port should be configurations and
21
+
# automatically allowed by the firewall.
22
+
networking.firewall.enable = false;
23
+
services.munge.enable = true;
24
+
services.slurm = slurmconfig;
28
+
{ config, pkgs, ...}:
30
+
networking.firewall.enable = false;
31
+
services.munge.enable = true;
33
+
server.enable = true;
36
+
node1 = computeNode;
37
+
node2 = computeNode;
38
+
node3 = computeNode;
45
+
# Set up authentification across the cluster
46
+
foreach my $node (($control,$node1,$node2,$node3))
48
+
$node->waitForUnit("default.target");
50
+
$node->succeed("mkdir /etc/munge");
51
+
$node->succeed("echo '${mungekey}' > /etc/munge/munge.key");
52
+
$node->succeed("chmod 0400 /etc/munge/munge.key");
53
+
$node->succeed("systemctl restart munged");
56
+
# Restart the services since they have probably failed due to the munge init
59
+
subtest "can_start_slurmctld", sub {
60
+
$control->succeed("systemctl restart slurmctld");
61
+
$control->waitForUnit("slurmctld.service");
64
+
subtest "can_start_slurmd", sub {
65
+
foreach my $node (($control,$node1,$node2,$node3))
67
+
$node->succeed("systemctl restart slurmd.service");
68
+
$node->waitForUnit("slurmd");
72
+
# Test that the cluster work and can distribute jobs;
74
+
subtest "run_distributed_command", sub {
75
+
# Run `hostname` on 3 nodes of the partition (so on all the 3 nodes).
76
+
# The output must contain the 3 different names
77
+
$control->succeed("srun -N 3 hostname | sort | uniq | wc -l | xargs test 3 -eq");