mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/tests/rstp: init
This commit is contained in:
@@ -1408,6 +1408,7 @@ in
|
||||
rspamd-trainer = runTest ./rspamd-trainer.nix;
|
||||
rss-bridge = handleTest ./web-apps/rss-bridge { };
|
||||
rss2email = handleTest ./rss2email.nix { };
|
||||
rstp = runTest ./rstp.nix;
|
||||
rstudio-server = runTest ./rstudio-server.nix;
|
||||
rsync = runTest ./rsync.nix;
|
||||
rsyncd = runTest ./rsyncd.nix;
|
||||
|
||||
@@ -55,24 +55,6 @@
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
specialisation.eth1-rstp.configuration = {
|
||||
networking.bridges.br0 = {
|
||||
interfaces = [ "eth1" ];
|
||||
rstp = lib.mkForce true;
|
||||
};
|
||||
|
||||
networking.interfaces = {
|
||||
eth1.ipv4.addresses = lib.mkForce [ ];
|
||||
eth1.ipv6.addresses = lib.mkForce [ ];
|
||||
br0.ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.1.2";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -100,19 +82,6 @@
|
||||
"grep eth1 /run/br0.interfaces >&2",
|
||||
)
|
||||
|
||||
# activating rstp needs another service, therefore the bridge will restart and the container will lose its connectivity
|
||||
# with subtest("Bridged configuration with STP"):
|
||||
# client.succeed("/run/booted-system/specialisation/eth1-rstp/bin/switch-to-configuration test >&2")
|
||||
# client.execute("ip -4 a >&2")
|
||||
# client.execute("ip l >&2")
|
||||
#
|
||||
# client.succeed(
|
||||
# "ping 192.168.1.122 -c 1 -n >&2",
|
||||
# "nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2",
|
||||
# "ip l show eth1 |grep 'master br0' >&2",
|
||||
# "grep eth1 /run/br0.interfaces >&2",
|
||||
# )
|
||||
|
||||
with subtest("Reverting to initial configuration preserves connectivity"):
|
||||
client.succeed(
|
||||
"/run/booted-system/bin/switch-to-configuration test >&2"
|
||||
|
||||
66
nixos/tests/rstp.nix
Normal file
66
nixos/tests/rstp.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
name = "rstp";
|
||||
|
||||
nodes = {
|
||||
client = {
|
||||
containers = {
|
||||
peer = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostBridge = "br0";
|
||||
|
||||
config = {
|
||||
networking = {
|
||||
interfaces = {
|
||||
eth0 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.1.122";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
bridges = {
|
||||
br0 = {
|
||||
interfaces = [ ];
|
||||
rstp = true;
|
||||
};
|
||||
};
|
||||
|
||||
interfaces = {
|
||||
eth1 = {
|
||||
ipv4.addresses = lib.mkForce [ ];
|
||||
ipv6.addresses = lib.mkForce [ ];
|
||||
};
|
||||
|
||||
br0 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.1.2";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
vlans = [ 1 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
client.start()
|
||||
client.wait_for_unit("default.target")
|
||||
client.wait_until_succeeds("journalctl | grep 'Port vb-peer : up'", timeout=10)
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user