openvswitch: init simple bridge test and add incus test

This commit is contained in:
Adam Stephens 2024-09-26 09:26:10 -04:00
parent 666014dbf9
commit 52335fc1b0
No known key found for this signature in database
3 changed files with 71 additions and 1 deletions

View File

@ -740,6 +740,7 @@ in {
image-contents = handleTest ./image-contents.nix {};
openvscode-server = handleTest ./openvscode-server.nix {};
open-webui = runTest ./open-webui.nix;
openvswitch = runTest ./openvswitch.nix;
orangefs = handleTest ./orangefs.nix {};
os-prober = handleTestOn ["x86_64-linux"] ./os-prober.nix {};
osquery = handleTestOn ["x86_64-linux"] ./osquery.nix {};

View File

@ -0,0 +1,62 @@
{
name = "openvswitch";
nodes = {
node1 = {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = true;
useDHCP = false;
firewall.enable = false;
vswitches.vs0 = {
interfaces = {
eth1 = { };
};
};
};
systemd.network.networks."40-vs0" = {
name = "vs0";
networkConfig.Address = "10.0.0.1/24";
};
};
node2 = {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = true;
useDHCP = false;
firewall.enable = false;
vswitches.vs0 = {
interfaces = {
eth1 = { };
};
};
};
systemd.network.networks."40-vs0" = {
name = "vs0";
networkConfig.Address = "10.0.0.2/24";
};
};
};
testScript = # python
''
start_all()
node1.wait_for_unit("ovsdb.service")
node1.wait_for_unit("ovs-vswitchd.service")
node2.wait_for_unit("ovsdb.service")
node2.wait_for_unit("ovs-vswitchd.service")
node1.succeed("ping -c3 10.0.0.2")
node2.succeed("ping -c3 10.0.0.1")
'';
}

View File

@ -125,7 +125,14 @@ stdenv.mkDerivation rec {
setuptools
]);
passthru.updateScript = nix-update-script { };
passthru = {
tests = {
default = nixosTests.openvswitch;
incus = nixosTests.incus-lts.openvswitch;
};
updateScript = nix-update-script { };
};
meta = with lib; {
changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";