Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander committed Feb 4, 2021
1 parent 9c9460c commit a459946
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis/linux_openresty_common_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ script() {
make lint && make license-check || exit 1

# APISIX_ENABLE_LUACOV=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
FLUSH_ETCD=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
}

after_success() {
Expand Down
17 changes: 17 additions & 0 deletions t/APISIX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,21 @@ _EOC_
$block;
});

sub run_or_exit ($) {
my ($cmd) = @_;
my $output = `$cmd`;
if ($?) {
warn "$output";
exit 1;
}
}

add_cleanup_handler(sub {
if ($ENV{FLUSH_ETCD}) {
delete $ENV{APISIX_PROFILE};
run_or_exit "etcdctl del --prefix /apisix";
run_or_exit "./bin/apisix init_etcd";
}
});

1;
3 changes: 2 additions & 1 deletion t/core/etcd-auth-fail.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# limitations under the License.
#
BEGIN {
$ENV{"ETCD_ENABLE_AUTH"} = "false"
$ENV{"ETCD_ENABLE_AUTH"} = "false";
delete $ENV{"FLUSH_ETCD"};
}

use t::APISIX 'no_plan';
Expand Down
3 changes: 2 additions & 1 deletion t/core/etcd-auth.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# limitations under the License.
#
BEGIN {
$ENV{"ETCD_ENABLE_AUTH"} = "true"
$ENV{"ETCD_ENABLE_AUTH"} = "true";
delete $ENV{"FLUSH_ETCD"};
}

use t::APISIX 'no_plan';
Expand Down
2 changes: 1 addition & 1 deletion utils/centos7-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ run_case() {
export_or_prefix
./utils/set-dns.sh
# run test cases
prove -I./test-nginx/lib -I./ -r -s t/
FLUSH_ETCD=1 prove -I./test-nginx/lib -I./ -r t/
}

case_opt=$1
Expand Down

0 comments on commit a459946

Please sign in to comment.