sigs.k8s.io/cluster-api@v1.7.1/internal/controllers/topology/cluster/structuredmerge/suite_test.go (about) 1 /* 2 Copyright 2022 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package structuredmerge 18 19 import ( 20 "os" 21 "testing" 22 "time" 23 24 . "github.com/onsi/gomega" 25 apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 26 "k8s.io/apimachinery/pkg/runtime" 27 clientgoscheme "k8s.io/client-go/kubernetes/scheme" 28 ctrl "sigs.k8s.io/controller-runtime" 29 30 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 31 "sigs.k8s.io/cluster-api/internal/test/envtest" 32 ) 33 34 var ( 35 ctx = ctrl.SetupSignalHandler() 36 fakeScheme = runtime.NewScheme() 37 env *envtest.Environment 38 ) 39 40 func init() { 41 _ = clientgoscheme.AddToScheme(fakeScheme) 42 _ = clusterv1.AddToScheme(fakeScheme) 43 _ = apiextensionsv1.AddToScheme(fakeScheme) 44 } 45 46 func TestMain(m *testing.M) { 47 SetDefaultEventuallyPollingInterval(100 * time.Millisecond) 48 SetDefaultEventuallyTimeout(30 * time.Second) 49 os.Exit(envtest.Run(ctx, envtest.RunInput{ 50 M: m, 51 SetupEnv: func(e *envtest.Environment) { env = e }, 52 // We are testing the patch helper against a real API Server, no need of additional indexes/reconcilers. 53 MinK8sVersion: "v1.22.0", // ClusterClass uses server side apply that went GA in 1.22; we do not support previous version because of bug/inconsistent behaviours in the older release. 54 })) 55 }