mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 01:34:21 -04:00 
			
		
		
		
	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>
This commit is contained in:
		| @@ -16,6 +16,7 @@ func TestDebug(t *testing.T) { | |||||||
| 	if x := f.String(); x != "" { | 	if x := f.String(); x != "" { | ||||||
| 		t.Errorf("Expected no debug logs, got %s", x) | 		t.Errorf("Expected no debug logs, got %s", x) | ||||||
| 	} | 	} | ||||||
|  | 	f.Reset() | ||||||
|  |  | ||||||
| 	D = true | 	D = true | ||||||
| 	Debug("debug") | 	Debug("debug") | ||||||
| @@ -34,6 +35,7 @@ func TestDebugx(t *testing.T) { | |||||||
| 	if x := f.String(); !strings.Contains(x, debug+"debug") { | 	if x := f.String(); !strings.Contains(x, debug+"debug") { | ||||||
| 		t.Errorf("Expected debug log to be %s, got %s", debug+"debug", x) | 		t.Errorf("Expected debug log to be %s, got %s", debug+"debug", x) | ||||||
| 	} | 	} | ||||||
|  | 	f.Reset() | ||||||
|  |  | ||||||
| 	Debug("debug") | 	Debug("debug") | ||||||
| 	if x := f.String(); !strings.Contains(x, 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) { | 	if x := f.String(); !strings.Contains(x, info+ts) { | ||||||
| 		t.Errorf("Expected log to be %s, got %s", info+ts, x) | 		t.Errorf("Expected log to be %s, got %s", info+ts, x) | ||||||
| 	} | 	} | ||||||
|  | 	f.Reset() | ||||||
| 	Warning(ts) | 	Warning(ts) | ||||||
| 	if x := f.String(); !strings.Contains(x, warning+ts) { | 	if x := f.String(); !strings.Contains(x, warning+ts) { | ||||||
| 		t.Errorf("Expected log to be %s, got %s", warning+ts, x) | 		t.Errorf("Expected log to be %s, got %s", warning+ts, x) | ||||||
| 	} | 	} | ||||||
|  | 	f.Reset() | ||||||
| 	Error(ts) | 	Error(ts) | ||||||
| 	if x := f.String(); !strings.Contains(x, err+ts) { | 	if x := f.String(); !strings.Contains(x, err+ts) { | ||||||
| 		t.Errorf("Expected log to be %s, got %s", err+ts, x) | 		t.Errorf("Expected log to be %s, got %s", err+ts, x) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user