Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.11] Adapt tests for upstream changes #765

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/roles/k3s/server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ in {
"--node-taint=node-role.kubernetes.io/server=true:NoSchedule"
"--flannel-backend=host-gw"
"--flannel-iface=ethsrv"
"--datastore-endpoint=postgres://@:5432/kubernetes?host=/run/postgresql"
"--datastore-endpoint=postgres:///kubernetes?host=/run/postgresql"
"--token-file=/var/lib/k3s/secret_token"
"--data-dir=/var/lib/k3s"
"--kube-apiserver-arg enable-admission-plugins=PodNodeSelector"
Expand Down
14 changes: 10 additions & 4 deletions tests/coturn.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test-python.nix ({ pkgs, lib, ... }:
import ./make-test-python.nix ({ pkgs, lib, testlib, ... }:
let

netLoc4Srv = "10.0.1";
Expand Down Expand Up @@ -44,7 +44,7 @@ in {
gateways = {};
};
interfaces.srv = {
mac = "52:54:00:12:34:56";
mac = "52:54:00:12:01:01";
bridged = false;
networks = {
"192.168.101.0/24" = [ "192.168.101.1" ];
Expand All @@ -53,7 +53,10 @@ in {
gateways = {};
};
};
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = testlib.fcVlanIfaces {
fe = 1;
srv = 2;
};
};

turnserver =
Expand Down Expand Up @@ -87,7 +90,10 @@ in {
environment.etc.hosts.text = lib.mkForce hosts;
networking.domain = "fcio.net";
networking.firewall.allowedTCPPorts = [ 5349 ];
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = testlib.fcVlanIfaces {
fe = 1;
srv = 2;
};

# ACME does not work in tests so coturn always uses the preliminary
# self-signed certs. They don't have the right permissions so we fix it
Expand Down
36 changes: 18 additions & 18 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ in {
# channel = callTest ./channel.nix {};
# XXX: ceph build failure
# ceph = callTest ./ceph.nix {};
# coturn = callTest ./coturn.nix {};
coturn = callTest ./coturn.nix {};
devhost = callTest ./devhost.nix {};
docker = callTest ./docker.nix {};
fcagent = callSubTests ./fcagent.nix {};
ffmpeg = callTest ./ffmpeg.nix {};
filebeat = callTest ./filebeat.nix {};
collect-garbage = callTest ./collect-garbage.nix {};
# gitlab = callTest ./gitlab.nix {};
gitlab = callTest ./gitlab.nix {};
haproxy = callTest ./haproxy.nix {};
java = callTest ./java.nix {};
journal = callTest ./journal.nix {};
journalbeat = callTest ./journalbeat.nix {};
kernelconfig = callTest ./kernelconfig.nix {};
# k3s = callTest ./k3s {};
k3s = callTest ./k3s {};

lampVm = callTest ./lamp/vm-test.nix { };
lampVm72 = callTest ./lamp/vm-test.nix { version = "lamp_php72"; };
Expand All @@ -70,40 +70,40 @@ in {
locale = callTest ./locale.nix {};
login = callTest ./login.nix {};
logrotate = callTest ./logrotate.nix {};
# mail = callTest ./mail {};
mail = callTest ./mail {};
mailstub = callTest ./mail/stub.nix {};
# matomo = callTest ./matomo.nix {};
matomo = callTest ./matomo.nix {};
memcached = callTest ./memcached.nix {};
#mongodb42 = callTest ./mongodb.nix { version = "4.2"; };
mysql57 = callTest ./mysql.nix { rolename = "mysql57"; };
# network = callSubTests ./network {};
network = callSubTests ./network {};
nfs = callTest ./nfs.nix {};
# nginx = callTest ./nginx.nix {};
nginx = callTest ./nginx.nix {};
nodejs = callTest ./nodejs.nix {};
# opensearch = callTest ./opensearch.nix {};
# opensearch_dashboards = callTest ./opensearch_dashboards.nix {};
# openvpn = callTest ./openvpn.nix {};
opensearch = callTest ./opensearch.nix {};
opensearch_dashboards = callTest ./opensearch_dashboards.nix {};
openvpn = callTest ./openvpn.nix {};
percona80 = callTest ./mysql.nix { rolename = "percona80"; };
physical-installer = callTest ./physical-installer.nix { inherit nixpkgs; };
# postgresql11 = callTest ./postgresql { version = "11"; };
# postgresql12 = callTest ./postgresql { version = "12"; };
# postgresql13 = callTest ./postgresql { version = "13"; };
# postgresql14 = callTest ./postgresql { version = "14"; };
# postgresql15 = callTest ./postgresql { version = "15"; };
postgresql11 = callTest ./postgresql { version = "11"; };
postgresql12 = callTest ./postgresql { version = "12"; };
postgresql13 = callTest ./postgresql { version = "13"; };
postgresql14 = callTest ./postgresql { version = "14"; };
postgresql15 = callTest ./postgresql { version = "15"; };
# postgresql-autoupgrade = callSubTests ./postgresql/upgrade.nix {};
prometheus = callTest ./prometheus.nix {};
rabbitmq = callTest ./rabbitmq.nix {};
redis = callTest ./redis.nix {};
rg-relay = callTest ./statshost/rg-relay.nix {};
# sensuclient = callTest ./sensuclient.nix {};
sensuclient = callTest ./sensuclient.nix {};
servicecheck = callTest ./servicecheck.nix {};
# statshost-global = callTest ./statshost/statshost-global.nix {};
statshost-global = callTest ./statshost/statshost-global.nix {};
statshost-master = callTest ./statshost/statshost-master.nix {};
sudo = callTest ./sudo.nix {};
syslog = callSubTests ./syslog.nix {};
systemd-service-cycles = callTest ./systemd-service-cycles.nix {};
users = callTest ./users.nix {};
# vxlan = callTest ./vxlan.nix {};
vxlan = callTest ./vxlan.nix {};
webproxy = callTest ./webproxy.nix {};
wkhtmltopdf = callTest ./wkhtmltopdf.nix {};
}
16 changes: 12 additions & 4 deletions tests/k3s/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ in {

virtualisation.memorySize = 2000;
virtualisation.diskSize = lib.mkForce 3000;
virtualisation.vlans = [ 1 2 ];
# do not automatically assign addresses based on vlan and
# guest id.
virtualisation.interfaces = {
ethfe = { vlan = 2; };
ethsrv = { vlan = 1; };
};
virtualisation.qemu.options = [ "-smp 2" ];
};
};
Expand Down Expand Up @@ -143,7 +148,7 @@ in {
networking.nameservers = [ "127.0.0.1" ];
virtualisation.memorySize = 2000;
virtualisation.diskSize = 3000;
virtualisation.vlans = [ 1 ];
virtualisation.interfaces.ethsrv.vlan = 1;
};
};

Expand Down Expand Up @@ -174,7 +179,7 @@ in {
networking.hostName = lib.mkForce "k3snodeB";
virtualisation.memorySize = 2000;
virtualisation.diskSize = 3000;
virtualisation.vlans = [ 1 ];
virtualisation.interfaces.ethsrv.vlan = 1;
};
};

Expand Down Expand Up @@ -206,9 +211,12 @@ in {
networking.domain = "fcio.net";
networking.extraHosts = hosts;
flyingcircus.encServices = encServices;
virtualisation.vlans = [ 1 2 ];
virtualisation.diskSize = 3000;
virtualisation.memorySize = 2000;
virtualisation.interfaces = {
ethfe = { vlan = 2; };
ethsrv = { vlan = 1; };
};
};


Expand Down
12 changes: 9 additions & 3 deletions tests/mail/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ../make-test-python.nix ({pkgs, lib, ...}:
import ../make-test-python.nix ({pkgs, lib, testlib, ...}:
let
commonConfig = {
networking.domain = "example.local";
Expand Down Expand Up @@ -46,7 +46,10 @@ in

flyingcircus.roles.postgresql14.enable = true;

virtualisation.vlans = [ 1 3 ];
virtualisation.interfaces = testlib.fcVlanIfaces {
fe = 1;
srv = 3;
};

flyingcircus.enc.parameters = {
resource_group = "test";
Expand Down Expand Up @@ -120,7 +123,10 @@ in
{
flyingcircus.services.nullmailer.enable = true;

virtualisation.vlans = [ 1 3 ];
virtualisation.interfaces = testlib.fcVlanIfaces {
fe = 1;
srv = 3;
};

flyingcircus.enc.parameters.interfaces.srv = {
mac = "52:54:00:12:03:01";
Expand Down
19 changes: 14 additions & 5 deletions tests/network/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ in {
{ pkgs, ... }:
{
imports = [ ../../nixos ../../nixos/roles ];
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethfe = { vlan = 1; };
ethsrv = { vlan = 2; };
};
flyingcircus.enc.parameters.interfaces = encInterfaces "1";
flyingcircus.encAddresses = [
{
Expand Down Expand Up @@ -166,7 +169,10 @@ in {
{ pkgs, ... }:
{
imports = [ ../../nixos ../../nixos/roles ];
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethfe = { vlan = 1; };
ethsrv = { vlan = 2; };
};
flyingcircus.enc.parameters.interfaces = encInterfaces "1";
};
nodes.router = router;
Expand Down Expand Up @@ -211,7 +217,7 @@ in {
{ pkgs, ... }:
{
imports = [ ../../nixos ../../nixos/roles ];
virtualisation.vlans = [ 2 ];
virtualisation.interfaces.ethsrv.vlan = 2;
flyingcircus.enc.parameters.interfaces = {
srv = { # VLAN 2
mac = "52:54:00:12:02:01";
Expand All @@ -233,7 +239,7 @@ in {
{ pkgs, ... }:
{
imports = [ ../../nixos ../../nixos/roles ];
virtualisation.vlans = [ 2 ];
virtualisation.interfaces.ethsrv.vlan = 2;
flyingcircus.enc.parameters.interfaces = {
srv = { # VLAN 2
mac = "52:54:00:12:02:02";
Expand Down Expand Up @@ -289,7 +295,10 @@ in {
{
networking.hostName = "srv${hostId}";
imports = [ ../../nixos ../../nixos/roles ];
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethfe = { vlan = 1; };
ethsrv = { vlan = 2; };
};
flyingcircus.infrastructureModule = "flyingcircus";
flyingcircus.enc.parameters.interfaces = encInterfaces hostId;
flyingcircus.localConfigPath = localConfigPath;
Expand Down
9 changes: 6 additions & 3 deletions tests/openvpn.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ in {
initialPassword = "test";
isNormalUser = true;
};
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethsrv = { vlan = 2; };
ethfe = { vlan = 1; };
};
};

internal =
Expand All @@ -84,7 +87,7 @@ in {
};
};
networking.firewall.allowPing = true;
virtualisation.vlans = [ 2 ];
virtualisation.interfaces.ethsrv.vlan = 2;
};

oclient =
Expand All @@ -110,7 +113,7 @@ in {
${gw4Fe} ${gwFeFqdn}
${gw6Fe} ${gwFeFqdn}
'';
virtualisation.vlans = [ 1 ];
virtualisation.interfaces.ethfe.vlan = 1;
};
};

Expand Down
12 changes: 10 additions & 2 deletions tests/statshost/statshost-global.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ in {
gateways = {};
};
};
virtualisation.vlans = [ 1 2 ];
# don't use the automatically generated ip addresses
virtualisation.interfaces = {
ethsrv = { vlan = 1; };
ethfe = { vlan = 2; };
};
};

statshost =
Expand Down Expand Up @@ -167,7 +171,10 @@ in {
extraGroups = [ "service" ];
};

virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethsrv = { vlan = 1; };
ethfe = { vlan = 2; };
};
virtualisation.memorySize = 3000;
virtualisation.diskSize = 1000;

Expand All @@ -191,6 +198,7 @@ in {
gateways = {};
};
};
virtualisation.interfaces.ethsrv.vlan = 1;
};

};
Expand Down
9 changes: 8 additions & 1 deletion tests/testlib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ rec {
extraGroups = [ "service" ];
};

virtualisation.vlans = map (vlan: vlans.${vlan}) (attrNames config.flyingcircus.enc.parameters.interfaces);
virtualisation.interfaces =
fcVlanIfaces (listToAttrs (map (vlan: nameValuePair vlan vlans.${vlan})
(attrNames config.flyingcircus.enc.parameters.interfaces)));

flyingcircus.enc.parameters = (lib.recursiveUpdate {
inherit resource_group location secrets;
Expand All @@ -118,6 +120,11 @@ rec {
};
};

fcVlanIfaces = mapAttrs' (vlan: vid: {
name = "eth${vlan}";
value = { vlan = vid; assignIP = true; };
});

fcIPMap = listToAttrs (concatLists (mapAttrsToList (name: vid: [
(nameValuePair "${name}4" {
quote = false;
Expand Down
9 changes: 6 additions & 3 deletions tests/vxlan.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ in {
};
networking.domain = "testdomain";
networking.firewall.allowPing = true;
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces = {
ethsrv = { vlan = 2; };
ethfe = { vlan = 1; };
};
};

remote =
Expand All @@ -99,7 +102,7 @@ in {
networking.firewall.logRefusedPackets = true;
networking.firewall.enable = false;
services.nginx.enable = true;
virtualisation.vlans = [ 1 2 ];
virtualisation.interfaces.ethfe.vlan = 1;
services.telegraf.enable = false;
};

Expand Down Expand Up @@ -131,7 +134,7 @@ in {
${gw6Srv} gw
'';
networking.firewall.allowPing = true;
virtualisation.vlans = [ 2 ];
virtualisation.interfaces.ethsrv.vlan = 2;
};

};
Expand Down