blob: 5bd7a9dd9b2ea564bf908ed89a3ece7856aa74fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
{
runTest,
pkgs,
lib,
# service/package name to test
rancherDistro,
}:
let
allPackages = lib.filterAttrs (
name: package:
builtins.match "^${rancherDistro}(_[[:digit:]]+)+$" name != null
&& (builtins.tryEval package).success
) pkgs;
allTests =
let
mkTestArgs = rancherPackage: {
inherit rancherDistro rancherPackage;
# systemd service name
serviceName =
{
k3s = "k3s";
rke2 = "rke2-server";
}
.${rancherDistro};
# list passed to services.*.disable,
# for slightly reduced resource usage
disabledComponents =
{
k3s = [
"coredns"
"local-storage"
"metrics-server"
"servicelb"
"traefik"
];
rke2 = [
"rke2-coredns"
"rke2-metrics-server"
"rke2-ingress-nginx"
"rke2-snapshot-controller"
"rke2-snapshot-controller-crd"
"rke2-snapshot-validation-webhook"
];
}
.${rancherDistro};
# images that must be present for all tests
coreImages =
{
k3s = [ ];
rke2 =
{
aarch64-linux = [
rancherPackage.images-core-linux-arm64-tar-zst
rancherPackage.images-canal-linux-arm64-tar-zst
];
x86_64-linux = [
rancherPackage.images-core-linux-amd64-tar-zst
rancherPackage.images-canal-linux-amd64-tar-zst
];
}
.${pkgs.stdenv.hostPlatform.system}
or (throw "RKE2: Unsupported system: ${pkgs.stdenv.hostPlatform.system}");
}
.${rancherDistro};
# virtualization.* attrs, since all distros
# need more resources than the default
vmResources =
{
k3s = {
memorySize = 1536;
diskSize = 4096;
};
rke2 = {
cores = 4;
memorySize = 4096;
diskSize = 8092;
};
}
.${rancherDistro};
};
mkTests =
path:
lib.mapAttrs (
name: package:
runTest {
imports = [ path ];
_module.args = mkTestArgs package;
}
) allPackages;
in
{
auto-deploy = mkTests ./auto-deploy.nix;
configuration = mkTests ./configuration.nix;
etcd = mkTests ./etcd.nix;
multi-node = mkTests ./multi-node.nix;
single-node = mkTests ./single-node.nix;
};
in
allTests
// {
all = lib.concatMapAttrs (
testType: lib.mapAttrs' (package: lib.nameValuePair "${testType}-${package}")
) allTests;
}
|