diff options
author | 2019-05-18 09:08:34 +0100 | |
---|---|---|
committer | 2019-05-18 09:08:34 +0100 | |
commit | d41e9ff7b7196374856d8db4bf33b31df8e20abc (patch) | |
tree | 6b54b4618973e35249742739a16d396ae16a60cf /plugin | |
parent | 2ef55f805e9f6e86f68721fac832dbcc5e8536c5 (diff) | |
download | coredns-d41e9ff7b7196374856d8db4bf33b31df8e20abc.tar.gz coredns-d41e9ff7b7196374856d8db4bf33b31df8e20abc.tar.zst coredns-d41e9ff7b7196374856d8db4bf33b31df8e20abc.zip |
pkg/log: reset the buffer in the tests (#2828)
Reset the buf otherwise we're not checking the new value.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/pkg/log/log_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugin/pkg/log/log_test.go b/plugin/pkg/log/log_test.go index c9ead7604..2b0de75cd 100644 --- a/plugin/pkg/log/log_test.go +++ b/plugin/pkg/log/log_test.go @@ -16,6 +16,7 @@ func TestDebug(t *testing.T) { if x := f.String(); x != "" { t.Errorf("Expected no debug logs, got %s", x) } + f.Reset() D = true Debug("debug") @@ -34,6 +35,7 @@ func TestDebugx(t *testing.T) { if x := f.String(); !strings.Contains(x, debug+"debug") { t.Errorf("Expected debug log to be %s, got %s", debug+"debug", x) } + f.Reset() Debug("debug") if x := f.String(); !strings.Contains(x, debug+"debug") { @@ -50,10 +52,12 @@ func TestLevels(t *testing.T) { if x := f.String(); !strings.Contains(x, info+ts) { t.Errorf("Expected log to be %s, got %s", info+ts, x) } + f.Reset() Warning(ts) if x := f.String(); !strings.Contains(x, warning+ts) { t.Errorf("Expected log to be %s, got %s", warning+ts, x) } + f.Reset() Error(ts) if x := f.String(); !strings.Contains(x, err+ts) { t.Errorf("Expected log to be %s, got %s", err+ts, x) |