~tomleb/mkproof-proxy-webhook

9cebbfea0c3a8b552d9e510b994c3f8ca69b9f4f — Tom Lebreux 2 years ago 9e07723
Dont use reflection for basic string equality test
1 files changed, 2 insertions(+), 3 deletions(-)

M pkg/mutator/mutator_test.go
M pkg/mutator/mutator_test.go => pkg/mutator/mutator_test.go +2 -3
@@ 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")
	}
}