|
| 1 | +// |
| 2 | +// Copyright (c) 2019-2026 Red Hat, Inc. |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | +// |
| 15 | + |
| 16 | +package workspace |
| 17 | + |
| 18 | +import ( |
| 19 | + "testing" |
| 20 | + |
| 21 | + "github.com/devfile/devworkspace-operator/pkg/infrastructure" |
| 22 | + "github.com/stretchr/testify/assert" |
| 23 | +) |
| 24 | + |
| 25 | +func TestGetWebhookAnnotationsWithOpenShift(t *testing.T) { |
| 26 | + infrastructure.InitializeForTesting(infrastructure.OpenShiftv4) |
| 27 | + annotations := getWebhookAnnotations("test-namespace") |
| 28 | + assert.Equal(t, map[string]string{ |
| 29 | + "service.beta.openshift.io/inject-cabundle": "true", |
| 30 | + }, annotations) |
| 31 | +} |
| 32 | + |
| 33 | +func TestGetWebhookAnnotationsWithKubernetes(t *testing.T) { |
| 34 | + infrastructure.InitializeForTesting(infrastructure.Kubernetes) |
| 35 | + annotations := getWebhookAnnotations("test-namespace") |
| 36 | + assert.Equal(t, map[string]string{ |
| 37 | + "cert-manager.io/inject-ca-from": "test-namespace/devworkspace-controller-serving-cert", |
| 38 | + }, annotations) |
| 39 | +} |
0 commit comments