This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 11763b8  chore: avoid defining read_file repeatedly (#5062)
11763b8 is described below

commit 11763b806b8798c596181daad42642ee4172c65d
Author: 罗泽轩 <[email protected]>
AuthorDate: Wed Sep 15 09:52:44 2021 +0800

    chore: avoid defining read_file repeatedly (#5062)
---
 t/config-center-yaml/plugin.t | 11 +----------
 t/debug/hook.t                | 11 +----------
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/t/config-center-yaml/plugin.t b/t/config-center-yaml/plugin.t
index fa411cc..288782b 100644
--- a/t/config-center-yaml/plugin.t
+++ b/t/config-center-yaml/plugin.t
@@ -51,16 +51,7 @@ _EOC_
     }
 });
 
-sub read_file($) {
-    my $infile = shift;
-    open my $in, $infile
-        or die "cannot open $infile for reading: $!";
-    my $cert = do { local $/; <$in> };
-    close $in;
-    $cert;
-}
-
-our $debug_config = read_file("conf/debug.yaml");
+our $debug_config = t::APISIX::read_file("conf/debug.yaml");
 $debug_config =~ s/basic:\n  enable: false/basic:\n  enable: true/;
 
 run_tests();
diff --git a/t/debug/hook.t b/t/debug/hook.t
index 90794f1..68fcdb6 100644
--- a/t/debug/hook.t
+++ b/t/debug/hook.t
@@ -21,16 +21,7 @@ log_level('info');
 no_root_location();
 no_shuffle();
 
-sub read_file($) {
-    my $infile = shift;
-    open my $in, $infile
-        or die "cannot open $infile for reading: $!";
-    my $cert = do { local $/; <$in> };
-    close $in;
-    $cert;
-}
-
-our $debug_config = read_file("conf/debug.yaml");
+our $debug_config = t::APISIX::read_file("conf/debug.yaml");
 $debug_config =~ s/hook_conf:\n  enable: false/hook_conf:\n  enable: true/;
 
 run_tests();

Reply via email to