@@ -45,6 +45,7 @@ type fakeSyncWriter bool
45
45
func (w * fakeSyncWriter ) Write (p []byte ) (int , error ) {
46
46
return len (p ), nil
47
47
}
48
+
48
49
func (w * fakeSyncWriter ) Sync () error {
49
50
* w = true
50
51
return nil
@@ -209,8 +210,6 @@ var _ = Describe("Zap logger setup", func() {
209
210
})
210
211
211
212
It ("should log a standard non-namespaced NamespacedName name" , func () {
212
- Skip ("Skipping until we bumped k/k to v0.27.2" )
213
-
214
213
name := types.NamespacedName {Name : "some-node" }
215
214
logger .Info ("here's a kubernetes object" , "thing" , name )
216
215
@@ -245,8 +244,6 @@ var _ = Describe("Zap logger setup", func() {
245
244
})
246
245
247
246
It ("should log a standard namespaced NamespacedName name and namespace" , func () {
248
- Skip ("Skipping until we bumped k/k to v0.27.2" )
249
-
250
247
name := types.NamespacedName {Name : "some-pod" , Namespace : "some-ns" }
251
248
logger .Info ("here's a kubernetes object" , "thing" , name )
252
249
@@ -277,7 +274,6 @@ var _ = Describe("Zap logger setup", func() {
277
274
logger = New (WriteTo (logOut ), UseDevMode (false ))
278
275
})
279
276
defineTests ()
280
-
281
277
})
282
278
})
283
279
})
@@ -313,7 +309,6 @@ var _ = Describe("Zap log level flag options setup", func() {
313
309
314
310
Expect (string (outRaw )).Should (ContainSubstring (logInfoLevel0 ))
315
311
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel1 ))
316
-
317
312
})
318
313
319
314
It ("Should output only error logs, otherwise empty logs" , func () {
@@ -332,7 +327,6 @@ var _ = Describe("Zap log level flag options setup", func() {
332
327
333
328
Expect (outRaw ).To (BeEmpty ())
334
329
})
335
-
336
330
})
337
331
338
332
Context ("with zap-log-level with increased verbosity." , func () {
@@ -389,7 +383,6 @@ var _ = Describe("Zap log level flag options setup", func() {
389
383
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel1 ))
390
384
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel2 ))
391
385
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel3 ))
392
-
393
386
})
394
387
It ("Should output info, and debug logs with increased verbosity, and with production mode set to true." , func () {
395
388
args := []string {"--zap-log-level=3" , "--zap-devel=true" }
@@ -410,13 +403,10 @@ var _ = Describe("Zap log level flag options setup", func() {
410
403
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel1 ))
411
404
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel2 ))
412
405
Expect (string (outRaw )).Should (ContainSubstring (logDebugLevel3 ))
413
-
414
406
})
415
-
416
407
})
417
408
418
409
Context ("with zap-stacktrace-level options provided" , func () {
419
-
420
410
It ("Should output stacktrace at info level, with development mode set to true." , func () {
421
411
args := []string {"--zap-stacktrace-level=info" , "--zap-devel=true" }
422
412
fromFlags .BindFlags (& fs )
@@ -451,7 +441,6 @@ var _ = Describe("Zap log level flag options setup", func() {
451
441
Expect (out .StacktraceLevel .Enabled (zapcore .ErrorLevel )).To (BeFalse ())
452
442
Expect (out .StacktraceLevel .Enabled (zapcore .InfoLevel )).To (BeFalse ())
453
443
})
454
-
455
444
})
456
445
457
446
Context ("with only -zap-devel flag provided" , func () {
@@ -484,12 +473,10 @@ var _ = Describe("Zap log level flag options setup", func() {
484
473
Expect (out .Level ).To (BeNil ())
485
474
Expect (out .StacktraceLevel ).To (BeNil ())
486
475
Expect (out .EncoderConfigOptions ).To (BeNil ())
487
-
488
476
})
489
477
})
490
478
491
479
Context ("with zap-time-encoding flag provided" , func () {
492
-
493
480
It ("Should set time encoder in options" , func () {
494
481
args := []string {"--zap-time-encoding=rfc3339" }
495
482
fromFlags .BindFlags (& fs )
@@ -549,11 +536,9 @@ var _ = Describe("Zap log level flag options setup", func() {
549
536
Expect (json .Unmarshal (outRaw , & res )).To (Succeed ())
550
537
Expect (res ["ts" ]).Should (MatchRegexp (iso8601Pattern ))
551
538
})
552
-
553
539
})
554
540
555
541
Context ("with encoder options provided programmatically" , func () {
556
-
557
542
It ("Should set JSON Encoder, with given Millis TimeEncoder option, and MessageKey" , func () {
558
543
logOut := new (bytes.Buffer )
559
544
f := func (ec * zapcore.EncoderConfig ) {
0 commit comments