Skip to content

Commit 677472f

Browse files
committed
test-perl: Clean after each individual test
1 parent 704fa36 commit 677472f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

test-perl/t/mod_proxy_cluster/manager.t

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ use Apache::TestRequest 'GET_BODY';
1313
# use Test::More;
1414
use ModProxyCluster;
1515

16-
17-
plan tests => 5;
18-
19-
ok 1; # simple load test
16+
plan tests => 4;
2017

2118
Apache::TestRequest::module("mpc_test_host");
2219
my $hostport = Apache::TestRequest::hostport();
@@ -35,3 +32,7 @@ ok $data->is_success;
3532
$data = GET_BODY $url;
3633

3734
ok (index($data, "Node next") != -1);
35+
36+
# Clean after yourself
37+
CMD 'REMOVE-APP', "$url/*", ( JVMRoute => 'next' );
38+
sleep 25; # just to make sure we'll have enough time to get it removed

test-perl/t/mod_proxy_cluster/messages_ok.t

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use Apache::TestRequest 'GET';
1313
# use Test::More;
1414
use ModProxyCluster;
1515

16-
plan tests => 205;
16+
plan tests => 210;
1717

1818
Apache::TestRequest::module("mpc_test_host");
1919
my $hostport = Apache::TestRequest::hostport();
@@ -43,16 +43,18 @@ ok (index($resp->as_string, "Node spare") != -1);
4343
##### STATUS #####
4444
##################
4545

46-
$resp = CMD 'STATUS', $url, ( JVMRoute => 'spare' );
46+
foreach my $jvmroute ('next', 'spare') {
47+
$resp = CMD 'STATUS', $url, ( JVMRoute => $jvmroute );
4748

48-
ok $resp->is_success;
49+
ok $resp->is_success;
4950

50-
my %p = parse_response 'CONFIG', $resp->content;
51+
my %p = parse_response 'CONFIG', $resp->content;
5152

52-
ok ($p{JVMRoute} eq 'spare');
53-
ok ($p{Type} eq 'STATUS-RSP');
54-
ok (exists $p{id});
55-
ok (exists $p{State});
53+
ok ($p{JVMRoute} eq $jvmroute);
54+
ok ($p{Type} eq 'STATUS-RSP');
55+
ok (exists $p{id});
56+
ok (exists $p{State});
57+
}
5658

5759

5860
##################
@@ -62,13 +64,12 @@ ok (exists $p{State});
6264
$resp = CMD 'INFO', $url;
6365

6466
ok $resp->is_success;
65-
%p = parse_response 'INFO', $resp->content;
67+
my %p = parse_response 'INFO', $resp->content;
6668

6769
ok (@{$p{Nodes}} == 2);
6870
ok (@{$p{Contexts}} == 0);
6971
ok (@{$p{Hosts}} == 0);
7072

71-
# There are two Nodes already, one `spare` added by us and `next` from the previous tests
7273
## TODO: Make this implementation independent, i.e., we should not care whether indexing starts by 0 or 1...
7374
ok ($p{Nodes}->[0]{Name} eq 'next');
7475
ok ($p{Nodes}->[1]{Name} eq 'spare');
@@ -362,3 +363,11 @@ ok (@{$p{Balancers}} == 1);
362363
ok (@{$p{Nodes}} == 3);
363364
ok (@{$p{Contexts}} == 0);
364365
ok (@{$p{Hosts}} == 0);
366+
367+
368+
# Clean after yourself
369+
foreach my $jvmroute ('next', 'spare') {
370+
CMD 'REMOVE-APP', "$url/*", ( JVMRoute => $jvmroute );
371+
}
372+
373+
sleep 25;

0 commit comments

Comments
 (0)