Commit 8a0f3c7c authored by Francesc Guasch's avatar Francesc Guasch
Browse files

test(ports): check new ports in base are in clone too

issue #1197
parent 9a3fa095
...@@ -528,6 +528,8 @@ sub test_clone_exports_add_ports($vm) { ...@@ -528,6 +528,8 @@ sub test_clone_exports_add_ports($vm) {
$base->expose(port => 22, name => "ssh"); $base->expose(port => 22, name => "ssh");
my @base_ports0 = $base->list_ports(); my @base_ports0 = $base->list_ports();
$base->prepare_base(user => user_admin, with_cd => 1);
my $clone = $base->clone(name => new_domain_name, user => user_admin); my $clone = $base->clone(name => new_domain_name, user => user_admin);
$base->expose(port => 80, name => "web"); $base->expose(port => 80, name => "web");
my @base_ports = $base->list_ports(); my @base_ports = $base->list_ports();
...@@ -539,11 +541,14 @@ sub test_clone_exports_add_ports($vm) { ...@@ -539,11 +541,14 @@ sub test_clone_exports_add_ports($vm) {
for my $n ( 0 .. 1 ) { for my $n ( 0 .. 1 ) {
is($base_ports[$n]->{internal_port}, $clone_ports[$n]->{internal_port}); is($base_ports[$n]->{internal_port}, $clone_ports[$n]->{internal_port});
isnt($base_ports[$n]->{public_port}, $clone_ports[$n]->{public_port}); isnt($base_ports[$n]->{public_port}, $clone_ports[$n]->{public_port},"Same public port in clone and base for ".$base_ports[$n]->{internal_port});
is($base_ports[$n]->{name}, $clone_ports[$n]->{name}); is($base_ports[$n]->{name}, $clone_ports[$n]->{name});
} }
my $out = `iptables -t nat -L PREROUTING`; _wait_ip($vm, $clone);
die $out; wait_request( );
my @out = split /\n/, `iptables -t nat -L PREROUTING -n`;
ok(grep /dpt:\d+.*\d+:22/, @out);
ok(grep /dpt:\d+.*\d+:80/, @out);
$clone->remove(user_admin); $clone->remove(user_admin);
$base->remove(user_admin); $base->remove(user_admin);
...@@ -951,6 +956,7 @@ for my $vm_name ( 'KVM', 'Void' ) { ...@@ -951,6 +956,7 @@ for my $vm_name ( 'KVM', 'Void' ) {
next if !$vm; next if !$vm;
diag("Testing $vm_name"); diag("Testing $vm_name");
test_clone_exports_add_ports($vm);
test_no_dupe($vm); test_no_dupe($vm);
......
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