forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd_test.go
More file actions
52 lines (42 loc) · 1.43 KB
/
add_test.go
File metadata and controls
52 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-FileCopyrightText: SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package seedfinalizer_test
import (
"context"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
. "github.com/gardener/gardener/pkg/controllermanager/controller/controllerregistration/seedfinalizer"
)
var _ = Describe("Add", func() {
Describe("#MapControllerInstallationToSeed", func() {
var (
ctx context.Context
r *Reconciler
seedName string
controllerInstallation *gardencorev1beta1.ControllerInstallation
)
BeforeEach(func() {
ctx = context.Background()
r = &Reconciler{}
seedName = "seed-1"
controllerInstallation = &gardencorev1beta1.ControllerInstallation{
Spec: gardencorev1beta1.ControllerInstallationSpec{
SeedRef: corev1.ObjectReference{
Name: seedName,
},
},
}
})
It("should return a request with the seed name", func() {
Expect(r.MapControllerInstallationToSeed(ctx, controllerInstallation)).To(ConsistOf(reconcile.Request{NamespacedName: types.NamespacedName{Name: seedName}}))
})
It("should return nil when object is not a ControllerInstallation", func() {
Expect(r.MapControllerInstallationToSeed(ctx, nil)).To(BeNil())
})
})
})