mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-23 02:42:17 +00:00
test(xcat-core): the DUID integration test rewrites the radvd configuration of the host
xCAT-test/integration/dhcp_dhcpv6_duid.t runs makedhcp through kea_process_request, which calls configure_router_advertisements on every IPv6 run (xCAT-server/lib/xcat/plugins/dhcp.pm). The step did not localize $xCAT_plugin::dhcp::radvdconffile, so it wrote the real /etc/radvd.conf, and it called enableservice, checkservicestatus and restartservice on the radvd of the management node. The test plans skip_all unless it runs as root, and "ip netns exec" changes only the network namespace, so the mount namespace and the services are the host's. makedhcp_step now points $radvdconffile at the scratch directory of the test and stubs the three service calls, as xCAT-test/unit/dhcp_dhcpv6_duid.t already does. The DHCPv6 reservations the test measures are unchanged. Evidence: configure_router_advertisements driven with these four lines writes the scratch radvd.conf and reports nothing; without them it reports "Cannot write /etc/radvd.conf, so the IPv6 networks announce no route" and the scratch file stays absent. No other file in xCAT-test/integration reaches that sub. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -426,7 +426,17 @@ sub makedhcp_step {
|
||||
require_dhcp_plugin();
|
||||
my ( @errors, @warnings );
|
||||
|
||||
no warnings 'once';
|
||||
# kea_process_request calls configure_router_advertisements on every IPv6 run, and
|
||||
# "ip netns exec" shares the mount namespace of the host. Without the next four lines the
|
||||
# step rewrites /etc/radvd.conf of the management node and restarts its radvd.
|
||||
my ($scratch) = ( $ENV{XCATCFG} // '' ) =~ /\ASQLite:(.+)\z/;
|
||||
die "The makedhcp step needs the scratch directory of the test\n" unless $scratch && -d $scratch;
|
||||
|
||||
no warnings qw(once redefine);
|
||||
local $xCAT_plugin::dhcp::radvdconffile = "$scratch/radvd.conf";
|
||||
local *xCAT::Utils::enableservice = sub { return 0; };
|
||||
local *xCAT::Utils::checkservicestatus = sub { return 0; };
|
||||
local *xCAT::Utils::restartservice = sub { return 0; };
|
||||
local $xCAT_plugin::dhcp::callback = sub {
|
||||
my ($resp) = @_;
|
||||
push @errors, @{ $resp->{error} || [] };
|
||||
|
||||
Reference in New Issue
Block a user