Skip to content

Instantly share code, notes, and snippets.

@srhb
Created October 10, 2019 20:19
Show Gist options
  • Save srhb/f7f5a19c8a80553a4c7d082d06ff9347 to your computer and use it in GitHub Desktop.
Save srhb/f7f5a19c8a80553a4c7d082d06ff9347 to your computer and use it in GitHub Desktop.
{ system ? builtins.currentSystem,
config ? {},
pkgs ? import <nixpkgs> { inherit system config; overlays = []; }
}:
with import (pkgs.path + /nixos/lib/testing.nix) { inherit system pkgs; };
with pkgs.lib;
let
mac1 = "6a:bb:84:02:50:c4";
mac2 = "6a:bb:84:02:50:c5";
in
makeTest {
name = "bond-hwaddr-shenanigans";
machine = { config, pkgs, ... }: {
virtualisation.vlans = [ 1 2 3 ];
networking = {
interfaces.eth1.macAddress = mac1;
interfaces.eth1.ipv4.addresses = mkOverride 0 [];
interfaces.eth2.macAddress = mac2;
interfaces.eth2.ipv4.addresses = mkOverride 0 [];
bonds.bond.interfaces = [ "eth1" "eth2" ];
bonds.bond.driverOptions.mode = "802.3ad";
};
};
testScript = ''
startAll;
$machine->waitForUnit("network.target");
$machine->waitUntilSucceeds('ip a | grep -A1 eth1 | grep ${mac1}');
$machine->succeed('sleep 5');
$machine->succeed('ip a | grep -A1 bond | grep ${mac1}');
$machine->succeed('systemctl restart bond-netdev.service');
$machine->succeed('sleep 5');
$machine->succeed('ip a | grep -A1 eth1 | grep ${mac1}');
$machine->succeed('sleep 5');
$machine->succeed('ip a | grep -A1 bond | grep ${mac1}');
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment