diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 15efe3a06b56..34f8289bde38 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; diff --git a/nixos/tests/openvswitch.nix b/nixos/tests/openvswitch.nix new file mode 100644 index 000000000000..679641717a1f --- /dev/null +++ b/nixos/tests/openvswitch.nix @@ -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") + ''; +} diff --git a/pkgs/by-name/op/openvswitch/package.nix b/pkgs/by-name/op/openvswitch/package.nix index 3db85c0036a3..e6c891b22674 100644 --- a/pkgs/by-name/op/openvswitch/package.nix +++ b/pkgs/by-name/op/openvswitch/package.nix @@ -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";