Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Re-enable tests for v0.27.2 #2333

Merged
merged 1 commit into from May 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 1 addition & 16 deletions pkg/log/zap/zap_test.go
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