Unverified Commit 0ee71f90 authored by Francesc Guasch's avatar Francesc Guasch Committed by GitHub
Browse files

wip(backend): clean iptables table (#1379)

closes issue #1307
parent 58eefe42
......@@ -3004,7 +3004,7 @@ sub _remove_iptables {
confess "ERROR: Unknown args ".Dumper(\%args) if keys %args;
my $sth = $$CONNECTOR->dbh->prepare(
"UPDATE iptables SET time_deleted=?"
"DELETE FROM iptables "
." WHERE id=?"
);
my @iptables;
......@@ -3022,7 +3022,7 @@ sub _remove_iptables {
for my $entry (@ {$rule{$id_vm}}) {
my ($id, $iptables) = @$entry;
$self->_delete_ip_rule($iptables, $vm) if !$>;
$sth->execute(Ravada::Utils::now(), $id);
$sth->execute($id);
}
}
}
......
......@@ -5,6 +5,9 @@ use Data::Dumper;
use JSON::XS;
use Test::More;
no warnings "experimental::signatures";
use feature qw(signatures);
use lib 't/lib';
use Test::Ravada;
......@@ -64,6 +67,15 @@ sub test_fw_domain {
$domain->shutdown_now( $USER );
test_chain($vm_name, $local_ip,$local_port, $remote_ip, 0);
test_iptables_table_clean($vm_name, $domain);
}
sub test_iptables_table_clean($vm_name, $domain) {
my $sth = connector->dbh->prepare("SELECT count(*) FROM iptables WHERE id_domain=? ");
$sth->execute($domain->id);
my ($n) = $sth->fetchrow;
is($n,0) or exit;
}
sub test_fw_domain_stored {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment