Skip to content

Commit

Permalink
Re-enable tests for v0.27.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed May 18, 2023
1 parent 1fe22d0 commit c8b911b
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions pkg/log/zap/zap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type fakeSyncWriter bool
func (w *fakeSyncWriter) Write(p []byte) (int, error) {
return len(p), nil
}

func (w *fakeSyncWriter) Sync() error {
*w = true
return nil
Expand Down Expand Up @@ -209,8 +210,6 @@ var _ = Describe("Zap logger setup", func() {
})

It("should log a standard non-namespaced NamespacedName name", func() {
Skip("Skipping until we bumped k/k to v0.27.2")

name := types.NamespacedName{Name: "some-node"}
logger.Info("here's a kubernetes object", "thing", name)

Expand Down Expand Up @@ -245,8 +244,6 @@ var _ = Describe("Zap logger setup", func() {
})

It("should log a standard namespaced NamespacedName name and namespace", func() {
Skip("Skipping until we bumped k/k to v0.27.2")

name := types.NamespacedName{Name: "some-pod", Namespace: "some-ns"}
logger.Info("here's a kubernetes object", "thing", name)

Expand Down Expand Up @@ -277,7 +274,6 @@ var _ = Describe("Zap logger setup", func() {
logger = New(WriteTo(logOut), UseDevMode(false))
})
defineTests()

})
})
})
Expand Down Expand Up @@ -313,7 +309,6 @@ var _ = Describe("Zap log level flag options setup", func() {

Expect(string(outRaw)).Should(ContainSubstring(logInfoLevel0))
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel1))

})

It("Should output only error logs, otherwise empty logs", func() {
Expand All @@ -332,7 +327,6 @@ var _ = Describe("Zap log level flag options setup", func() {

Expect(outRaw).To(BeEmpty())
})

})

Context("with zap-log-level with increased verbosity.", func() {
Expand Down Expand Up @@ -389,7 +383,6 @@ var _ = Describe("Zap log level flag options setup", func() {
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel1))
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel2))
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel3))

})
It("Should output info, and debug logs with increased verbosity, and with production mode set to true.", func() {
args := []string{"--zap-log-level=3", "--zap-devel=true"}
Expand All @@ -410,13 +403,10 @@ var _ = Describe("Zap log level flag options setup", func() {
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel1))
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel2))
Expect(string(outRaw)).Should(ContainSubstring(logDebugLevel3))

})

})

Context("with zap-stacktrace-level options provided", func() {

It("Should output stacktrace at info level, with development mode set to true.", func() {
args := []string{"--zap-stacktrace-level=info", "--zap-devel=true"}
fromFlags.BindFlags(&fs)
Expand Down Expand Up @@ -451,7 +441,6 @@ var _ = Describe("Zap log level flag options setup", func() {
Expect(out.StacktraceLevel.Enabled(zapcore.ErrorLevel)).To(BeFalse())
Expect(out.StacktraceLevel.Enabled(zapcore.InfoLevel)).To(BeFalse())
})

})

Context("with only -zap-devel flag provided", func() {
Expand Down Expand Up @@ -484,12 +473,10 @@ var _ = Describe("Zap log level flag options setup", func() {
Expect(out.Level).To(BeNil())
Expect(out.StacktraceLevel).To(BeNil())
Expect(out.EncoderConfigOptions).To(BeNil())

})
})

Context("with zap-time-encoding flag provided", func() {

It("Should set time encoder in options", func() {
args := []string{"--zap-time-encoding=rfc3339"}
fromFlags.BindFlags(&fs)
Expand Down Expand Up @@ -549,11 +536,9 @@ var _ = Describe("Zap log level flag options setup", func() {
Expect(json.Unmarshal(outRaw, &res)).To(Succeed())
Expect(res["ts"]).Should(MatchRegexp(iso8601Pattern))
})

})

Context("with encoder options provided programmatically", func() {

It("Should set JSON Encoder, with given Millis TimeEncoder option, and MessageKey", func() {
logOut := new(bytes.Buffer)
f := func(ec *zapcore.EncoderConfig) {
Expand Down

0 comments on commit c8b911b

Please sign in to comment.