From 939343b64543e2467e1fadf40d8d43775f628d7d Mon Sep 17 00:00:00 2001 From: Garret Buell Date: Sat, 13 Jan 2024 08:32:26 -0800 Subject: [PATCH 1/2] Decode CBOR in the diode test to fix workflow failures --- diode/diode_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diode/diode_test.go b/diode/diode_test.go index a8d25076..ab6b55e3 100644 --- a/diode/diode_test.go +++ b/diode/diode_test.go @@ -70,7 +70,7 @@ func TestFatal(t *testing.T) { } want := "{\"level\":\"fatal\",\"message\":\"test\"}\n" - got := string(slurp) + got := cbor.DecodeIfBinaryToString(slurp) if got != want { t.Errorf("Diode Fatal Test failed. got:%s, want:%s!", got, want) } From a3175cd2c5a1b7ecc6d08efc2209ae7ff5b53ed3 Mon Sep 17 00:00:00 2001 From: Garret Buell Date: Sat, 13 Jan 2024 08:43:45 -0800 Subject: [PATCH 2/2] Use CBOR decoding in the ctx test which is also failing the workflow --- ctx_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ctx_test.go b/ctx_test.go index 397e966c..6315cf7a 100644 --- a/ctx_test.go +++ b/ctx_test.go @@ -6,6 +6,8 @@ import ( "io" "reflect" "testing" + + "github.com/rs/zerolog/internal/cbor" ) func TestCtx(t *testing.T) { @@ -93,7 +95,7 @@ func Test_InterfaceLogObjectMarshaler(t *testing.T) { withLog.Info().Msg("test") - if got, want := buf.String(), `{"level":"info","obj":{"name":"custom_value","age":29},"message":"test"}`+"\n"; got != want { + if got, want := cbor.DecodeIfBinaryToString(buf.Bytes()), `{"level":"info","obj":{"name":"custom_value","age":29},"message":"test"}`+"\n"; got != want { t.Errorf("got %q, want %q", got, want) } }