From 9cebbfea0c3a8b552d9e510b994c3f8ca69b9f4f Mon Sep 17 00:00:00 2001 From: Tom Lebreux Date: Fri, 11 Dec 2020 14:33:54 -0500 Subject: [PATCH] Dont use reflection for basic string equality test --- pkg/mutator/mutator_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/mutator/mutator_test.go b/pkg/mutator/mutator_test.go index 03a3914..2ec1e99 100644 --- a/pkg/mutator/mutator_test.go +++ b/pkg/mutator/mutator_test.go @@ -1,7 +1,6 @@ package mutator import ( - "reflect" "testing" "github.com/go-logr/logr" @@ -31,7 +30,7 @@ func TestMutatorHandler(t *testing.T) { } expectedPatch := `{"op":"add","path":"/spec/containers/1","value":{"args":["--listen-addr","0.0.0.0:8080","--upstream-url","http://127.0.0.1:9090"],"image":"quay.io/tomleb/mkproof-proxy:latest","name":"mkproof-proxy","resources":{}}}` - if !reflect.DeepEqual(response.Patches[0].Json(), expectedPatch) { + if response.Patches[0].Json() != expectedPatch { t.Fatal("wrong patch") } } @@ -58,7 +57,7 @@ func TestMutatorHandlerSecret(t *testing.T) { } expectedPatch := `{"op":"add","path":"/spec/containers/1","value":{"args":["--listen-addr","0.0.0.0:8080","--upstream-url","http://127.0.0.1:9090"],"env":[{"name":"MKPROOF_PROXY_SECRET_KEY","valueFrom":{"secretKeyRef":{"key":"secret-key","name":"my-secret"}}}],"image":"quay.io/tomleb/mkproof-proxy:latest","name":"mkproof-proxy","resources":{}}}` - if !reflect.DeepEqual(response.Patches[0].Json(), expectedPatch) { + if response.Patches[0].Json() != expectedPatch { t.Fatal("wrong patch") } } -- 2.45.2