X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=blobdiff_plain;f=test%2Ffwtester.pl;fp=test%2Ffwtester.pl;h=e9ed6d16bd2ade8c79168b58246181339becc37d;hp=2700ef39e40a3390238c5ace37a107725a619086;hb=6f6a6b3f8259c06fe9f7f14490caa5275996b5c6;hpb=06208a013f82b8654d009c7f6e10c2bd25b316bd diff --git a/test/fwtester.pl b/test/fwtester.pl index 2700ef3..e9ed6d1 100755 --- a/test/fwtester.pl +++ b/test/fwtester.pl @@ -5,6 +5,8 @@ use strict; use warnings; use Data::Dumper; use PVE::FirewallSimulator; +use PVE::INotify; +use PVE::Corosync; use Getopt::Long; use File::Basename; use Net::IP; @@ -19,6 +21,13 @@ if (!GetOptions ('debug' => \$debug)) { print_usage_and_exit(); } +# load dummy corosync config to have fw create according rules +my $corosync_conf_fn = "corosync.conf"; +my $raw = PVE::Tools::file_get_contents($corosync_conf_fn); +my $local_hostname = PVE::INotify::nodename(); +(my $raw_replaced = $raw) =~ s/proxself$/$local_hostname\n/gm; +my $corosync_conf = PVE::Corosync::parse_conf($corosync_conf_fn, $raw_replaced); + PVE::FirewallSimulator::debug($debug); my $testfilename = shift; @@ -37,7 +46,7 @@ sub run_tests { PVE::Firewall::local_network('172.16.1.0/24'); my ($ruleset, $ipset_ruleset) = - PVE::Firewall::compile(undef, undef, $vmdata, 1); + PVE::Firewall::compile(undef, undef, $vmdata, $corosync_conf); my $filename = "$testdir/$testfile"; my $fh = IO::File->new($filename) ||