Skip to content

Commit

Permalink
Remove TestCongifurewebhookServer
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <[email protected]>
  • Loading branch information
yiraeChristineKim authored and openshift-merge-bot[bot] committed Nov 27, 2023
1 parent f89d415 commit fedeb61
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
3 changes: 1 addition & 2 deletions pkg/webhook/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ var (
emitAdmissionEvents = flag.Bool("emit-admission-events", false, "(alpha) emit Kubernetes events for each admission violation")
admissionEventsInvolvedNamespace = flag.Bool("admission-events-involved-namespace", false, "emit admission events for each violation in the involved objects namespace, the default (false) generates events in the namespace Gatekeeper is installed in. Admission events from cluster-scoped resources will still follow the default behavior")
logStatsAdmission = flag.Bool("log-stats-admission", false, "(alpha) log stats for admission webhook")
tlsMinVersion = flag.String("tls-min-version", "1.2", "minimum version of TLS supported")
serviceaccount = fmt.Sprintf("system:serviceaccount:%s:%s", util.GetNamespace(), serviceAccountName)
VwhName = flag.String("validating-webhook-configuration-name", "gatekeeper-validating-webhook-configuration", "name of the ValidatingWebhookConfiguration")
MwhName = flag.String("mutating-webhook-configuration-name", "gatekeeper-mutating-webhook-configuration", "name of the MutatingWebhookConfiguration")
TLSMinVersion = flag.String("tls-min-version", "1.3", "minimum version of TLS supported")
TLSMinVersion = flag.String("tls-min-version", "1.2", "minimum version of TLS supported")
ClientCAName = flag.String("client-ca-name", "", "name of the certificate authority bundle to authenticate the Kubernetes API server requests against")
CertCNName = flag.String("client-cn-name", "kube-apiserver", "expected CN name on the client certificate attached by apiserver in requests to the webhook")
)
Expand Down
35 changes: 0 additions & 35 deletions pkg/webhook/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import (
"net"
"net/http"
"net/http/httptest"
"reflect"
"strings"
"testing"
"time"

"github.com/stretchr/testify/assert"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)

type chanWriter chan string
Expand All @@ -31,39 +29,6 @@ func (w chanWriter) Write(p []byte) (n int, err error) {
return len(p), nil
}

func TestCongifureWebhookServer(t *testing.T) {
expectedServer := &webhook.Server{
TLSMinVersion: "1.2",
}

if *clientCAName != "" {
expectedServer.ClientCAName = *clientCAName
}

tc := []struct {
Name string
Server *webhook.Server
ExpectedServer *webhook.Server
}{
{
Name: "Wbhook server config",
Server: &webhook.Server{},
ExpectedServer: expectedServer,
},
}

for _, tt := range tc {
t.Run(tt.Name, func(t *testing.T) {
server := congifureWebhookServer(tt.Server)
expectedServer.TLSOpts = server.TLSOpts

if !reflect.DeepEqual(tt.ExpectedServer, server) {
t.Errorf(fmt.Sprintf("got %#v, want %#v", server, tt.ExpectedServer))
}
})
}
}

func TestTLSConfig(t *testing.T) {
ca, caPEM, caPrivKey, err := getCA(*CertCNName)
if err != nil {
Expand Down

0 comments on commit fedeb61

Please sign in to comment.