@@ -17,18 +17,15 @@ limitations under the License.
1717package key_test
1818
1919import (
20- "reflect"
21-
2220 . "github.com/onsi/ginkgo/v2"
2321 . "github.com/onsi/gomega"
24- "github.com/onsi/gomega/gcustom"
25- gomegatypes "github.com/onsi/gomega/types"
2622 appsv1 "k8s.io/api/apps/v1"
2723 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2824 "k8s.io/utils/ptr"
2925
3026 shardingv1alpha1 "github.com/timebertt/kubernetes-controller-sharding/pkg/apis/sharding/v1alpha1"
3127 . "github.com/timebertt/kubernetes-controller-sharding/pkg/sharding/key"
28+ . "github.com/timebertt/kubernetes-controller-sharding/pkg/utils/test/matchers"
3229)
3330
3431var _ = Describe ("#FuncForResource" , func () {
@@ -76,7 +73,7 @@ var _ = Describe("#FuncForResource", func() {
7673 Group : "operator" ,
7774 Resource : "foo" ,
7875 }, controllerRing )).To (
79- beFunc (ForObject ),
76+ BeFunc (ForObject ),
8077 )
8178 })
8279
@@ -85,15 +82,15 @@ var _ = Describe("#FuncForResource", func() {
8582 Group : "operator" ,
8683 Resource : "controlled" ,
8784 }, controllerRing )).To (
88- beFunc (ForController ),
85+ BeFunc (ForController ),
8986 )
9087 })
9188
9289 It ("should return ForObject if the resource is a main and controlled resource of the ring" , func () {
9390 Expect (FuncForResource (metav1.GroupResource {
9491 Resource : "foo" ,
9592 }, controllerRing )).To (
96- beFunc (ForObject ),
93+ BeFunc (ForObject ),
9794 )
9895 })
9996})
@@ -177,9 +174,3 @@ var _ = Describe("#ForController", func() {
177174 Expect (ForController (obj )).To (Equal ("operator/Foo/bar/foo" ))
178175 })
179176})
180-
181- func beFunc (expected Func ) gomegatypes.GomegaMatcher {
182- return gcustom .MakeMatcher (func (actual Func ) (bool , error ) {
183- return reflect .ValueOf (expected ).Pointer () == reflect .ValueOf (actual ).Pointer (), nil
184- })
185- }
0 commit comments