This add several tests for SDN VNets. State setup as well as testing results is done only via the API to test on the API boundaries and not against the internal state. Internal state and config files are mocked to avoid requiring access to system files or pmxcfs.
The first 7 commits extract various functions to allow mocking them in the tests. The tests are then added as the test_vnets_blackbox test. The last commit removes the old vnets tests which are not working anyway. Tests validate the events of a nic joining a Vnet or a nic staring on a vnet with different subnet configurations. Further descriptions in the commit. *Several of the tests fail due to known bugs and limitations.* These bugs where discussed off-list with @s.hanreich and due to be fixed with the next set of SDN patches. Applying the tests first would allow fixing them with already existing tests. Differences v1 -> v2: * Add tests that expect a failure when no IP can be allocated * Removed commented out debug stuff Stefan Lendl (9): sdn: extract function that reads datacenter config dnsmasq: extract function to systemctl command. dnsmasq: extract function that generates the ethers file path dnsmasq: extract function that updates dnsmasq lease via dbus controllers: extract function that reads network intreaces config evpn: extract function that reads frr config. api: extract function that creates the sdn directory. tests: test VNets functionality as a blackbox tests: remove old Vnets tests src/PVE/API2/Network/SDN/Zones.pm | 6 +- src/PVE/Network/SDN/Controllers.pm | 16 +- src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 10 +- src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 47 +- src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 3 +- src/PVE/Network/SDN/Zones/Plugin.pm | 5 + src/PVE/Network/SDN/Zones/SimplePlugin.pm | 2 +- src/test/Makefile | 5 +- src/test/run_test_vnets.pl | 343 ------- src/test/run_test_vnets_blackbox.pl | 859 ++++++++++++++++++ 10 files changed, 925 insertions(+), 371 deletions(-) delete mode 100755 src/test/run_test_vnets.pl create mode 100755 src/test/run_test_vnets_blackbox.pl -- 2.44.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel