2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 17:02:15 +00:00
Files
xcat-core/xCAT-test/integration/fixtures/syncfiles-request.pl
T
Vinícius Ferrão ff2ec0d4ac test(syncfiles): verify authenticated hierarchy delivery
Exercise certificate policy and real SSH copies in a disposable MN/SN/node fixture. This test is opt-in and skips in ordinary CI without XCAT_SYNCFILES_LIVE_CONFIG.
2026-10-21 20:42:14 -03:00

30 lines
1021 B
Perl

use strict;
use warnings;
use File::Slurper qw(read_text);
use JSON::PP qw(decode_json encode_json);
use xCAT::Client;
my ($input) = @ARGV;
my $case = decode_json(read_text($input));
my @responses;
my $callback = sub { push @responses, $_[0]; };
delete $ENV{XCATBYPASS};
local $SIG{ALRM} = sub { die "Syncfiles request timed out\n"; };
alarm 60;
if ($case->{consumer}) {
require xCAT_plugin::syncfiles;
require xCAT_plugin::xdsh;
delete @ENV{qw(DSH_FROM_USERID DSH_TO_USERID)};
@ENV{keys %{$case->{inherited}}} = values %{$case->{inherited}};
xCAT_plugin::syncfiles::process_request($case->{request}, $callback, sub {
my ($request, $response) = @_;
xCAT_plugin::xdsh::preprocess_request($request, $response, sub { die 'Unexpected remote dispatch'; });
});
} else {
$ENV{XCATHOST} = $case->{endpoint};
xCAT::Client::submit_request($case->{request}, $callback,
$case->{credential}, $case->{credential}, $case->{ca});
}
alarm 0;
print encode_json(\@responses), "\n";