File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ package envtestutils
2
+
3
+ import apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
4
+
5
+ // CRDPtrsFromCRDs generates a slice of CRD pointers from a slice of CRDs
6
+ func CRDPtrsFromCRDs (crds []apiextensionsv1.CustomResourceDefinition ) (ptrs []* apiextensionsv1.CustomResourceDefinition ) {
7
+ for i := range crds {
8
+ ptrs = append (ptrs , & crds [i ])
9
+ }
10
+ return
11
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 OnMetal authors
2
+ //
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
+ package envtestutils
16
+
17
+ import (
18
+ "testing"
19
+
20
+ . "github.com/onsi/ginkgo"
21
+ . "github.com/onsi/gomega"
22
+ )
23
+
24
+ func TestEnvtestutils (t * testing.T ) {
25
+ RegisterFailHandler (Fail )
26
+ RunSpecs (t , "Envtestutils Suite" )
27
+ }
Original file line number Diff line number Diff line change
1
+ package envtestutils
2
+
3
+ import (
4
+ . "github.com/onsi/ginkgo"
5
+ . "github.com/onsi/gomega"
6
+ apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
7
+ )
8
+
9
+ var _ = Describe ("CRDPtrsFromCRDs" , func () {
10
+ It ("returns CRD pointers from CRDs" , func () {
11
+ crdA := apiextensionsv1.CustomResourceDefinition {}
12
+ crdB := apiextensionsv1.CustomResourceDefinition {}
13
+
14
+ crds := []apiextensionsv1.CustomResourceDefinition {crdA , crdB }
15
+
16
+ Expect (CRDPtrsFromCRDs (crds )).To (Equal ([]* apiextensionsv1.CustomResourceDefinition {& crdA , & crdB }))
17
+ })
18
+ })
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ require (
9
9
github.com/onsi/gomega v1.17.0
10
10
github.com/spf13/pflag v1.0.5
11
11
k8s.io/api v0.23.1
12
+ k8s.io/apiextensions-apiserver v0.23.0
12
13
k8s.io/apimachinery v0.23.1
13
14
k8s.io/client-go v0.23.1
14
15
sigs.k8s.io/controller-runtime v0.11.0
You can’t perform that action at this time.
0 commit comments