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

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 356b220f fix: TestRotateLog (#1246)
356b220f is described below

commit 356b220f4b92c644e8a937164fca2517ed3e6a4f
Author: Xin Rong <[email protected]>
AuthorDate: Mon Aug 15 18:05:34 2022 +0800

    fix: TestRotateLog (#1246)
---
 cmd/ingress/ingress_test.go | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmd/ingress/ingress_test.go b/cmd/ingress/ingress_test.go
index a32a00b7..c72a2fe1 100644
--- a/cmd/ingress/ingress_test.go
+++ b/cmd/ingress/ingress_test.go
@@ -170,6 +170,8 @@ func TestRotateLog(t *testing.T) {
        cmd.SetArgs([]string{
                "--log-rotate-output-path", "./testlog/test.log",
                "--log-rotate-max-size", "1",
+               "--log-level", "debug",
+               "--log-output", "./testlog/test.log",
                "--http-listen", listen,
                "--enable-profiling",
                "--kubeconfig", "/foo/bar/baz",
@@ -185,6 +187,12 @@ func TestRotateLog(t *testing.T) {
                close(stopCh)
        }()
 
+       fws := &fakeWriteSyncer{}
+       logger, err := log.NewLogger(log.WithLogLevel("debug"), 
log.WithWriteSyncer(fws))
+       assert.Nil(t, err)
+       defer logger.Close()
+       log.DefaultLogger = logger
+
        // fill logs with data until the size > 1m
        line := ""
        for i := 0; i < 256; i++ {
@@ -192,7 +200,7 @@ func TestRotateLog(t *testing.T) {
        }
 
        for i := 0; i < 4096; i++ {
-               log.Info(line)
+               log.Debug(line)
        }
 
        time.Sleep(5 * time.Second)
@@ -206,5 +214,4 @@ func TestRotateLog(t *testing.T) {
        }
 
        assert.Equal(t, true, len(files) >= 2)
-
 }

Reply via email to