Skip to content

Commit

Permalink
test-perl: Clean after each individual test
Browse files Browse the repository at this point in the history
  • Loading branch information
jajik committed Oct 25, 2024
1 parent 3d28fb7 commit b1fa50b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
9 changes: 5 additions & 4 deletions test-perl/t/mod_proxy_cluster/manager.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ use Apache::TestRequest 'GET_BODY';
# use Test::More;
use ModProxyCluster;


plan tests => 5;

ok 1; # simple load test
plan tests => 4;

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

ok (index($data, "Node next") != -1);

# Clean after yourself
CMD 'REMOVE-APP', "$url/*", ( JVMRoute => 'next' );
sleep 25; # just to make sure we'll have enough time to get it removed
29 changes: 19 additions & 10 deletions test-perl/t/mod_proxy_cluster/messages_ok.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Apache::TestRequest 'GET';
# use Test::More;
use ModProxyCluster;

plan tests => 205;
plan tests => 210;

Apache::TestRequest::module("mpc_test_host");
my $hostport = Apache::TestRequest::hostport();
Expand Down Expand Up @@ -43,16 +43,18 @@ ok (index($resp->as_string, "Node spare") != -1);
##### STATUS #####
##################

$resp = CMD 'STATUS', $url, ( JVMRoute => 'spare' );
foreach my $jvmroute ('next', 'spare') {
$resp = CMD 'STATUS', $url, ( JVMRoute => $jvmroute );

ok $resp->is_success;
ok $resp->is_success;

my %p = parse_response 'CONFIG', $resp->content;
my %p = parse_response 'CONFIG', $resp->content;

ok ($p{JVMRoute} eq 'spare');
ok ($p{Type} eq 'STATUS-RSP');
ok (exists $p{id});
ok (exists $p{State});
ok ($p{JVMRoute} eq $jvmroute);
ok ($p{Type} eq 'STATUS-RSP');
ok (exists $p{id});
ok (exists $p{State});
}


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

ok $resp->is_success;
%p = parse_response 'INFO', $resp->content;
my %p = parse_response 'INFO', $resp->content;

ok (@{$p{Nodes}} == 2);
ok (@{$p{Contexts}} == 0);
ok (@{$p{Hosts}} == 0);

# There are two Nodes already, one `spare` added by us and `next` from the previous tests
## TODO: Make this implementation independent, i.e., we should not care whether indexing starts by 0 or 1...
ok ($p{Nodes}->[0]{Name} eq 'next');
ok ($p{Nodes}->[1]{Name} eq 'spare');
Expand Down Expand Up @@ -362,3 +363,11 @@ ok (@{$p{Balancers}} == 1);
ok (@{$p{Nodes}} == 3);
ok (@{$p{Contexts}} == 0);
ok (@{$p{Hosts}} == 0);


# Clean after yourself
foreach my $jvmroute ('next', 'spare') {
CMD 'REMOVE-APP', "$url/*", ( JVMRoute => $jvmroute );
}

sleep 25;

0 comments on commit b1fa50b

Please sign in to comment.