Commit 917ed998 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

test(ports): new ports exposed added on clone start

issue #1197
parent b2b88419
......@@ -522,6 +522,34 @@ sub test_clone_exports($vm) {
$base->remove(user_admin);
}
sub test_clone_exports_add_ports($vm) {
my $base = create_domain($vm, user_admin,'debian stretch');
$base->expose(port => 22, name => "ssh");
my @base_ports0 = $base->list_ports();
my $clone = $base->clone(name => new_domain_name, user => user_admin);
$base->expose(port => 80, name => "web");
my @base_ports = $base->list_ports();
is(scalar @base_ports, scalar @base_ports0 + 1);
$clone->start(remote_ip => '10.1.1.1', user => user_admin);
my @clone_ports = $clone->list_ports();
is(scalar @clone_ports,2 );
for my $n ( 0 .. 1 ) {
is($base_ports[$n]->{internal_port}, $clone_ports[$n]->{internal_port});
isnt($base_ports[$n]->{public_port}, $clone_ports[$n]->{public_port});
is($base_ports[$n]->{name}, $clone_ports[$n]->{name});
}
my $out = `iptables -t nat -L PREROUTING`;
die $out;
$clone->remove(user_admin);
$base->remove(user_admin);
}
sub _wait_ip {
my $vm_name = shift;
my $domain = shift or confess "Missing domain arg";
......@@ -945,6 +973,7 @@ for my $vm_name ( 'KVM', 'Void' ) {
test_clone_exports($vm);
test_clone_exports_add_ports($vm);
}
flush_rules();
......
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