sigs.k8s.io/cluster-api-provider-aws@v1.5.5/test/e2e/suites/managed/managed_suite_test.go (about) 1 //go:build e2e 2 // +build e2e 3 4 /* 5 Copyright 2020 The Kubernetes Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 */ 19 20 package managed 21 22 import ( 23 "flag" 24 "testing" 25 26 "github.com/onsi/ginkgo" 27 . "github.com/onsi/gomega" 28 "k8s.io/apimachinery/pkg/runtime" 29 30 ekscontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/controlplane/eks/api/v1beta1" 31 expinfrav1 "sigs.k8s.io/cluster-api-provider-aws/exp/api/v1beta1" 32 "sigs.k8s.io/cluster-api-provider-aws/test/e2e/shared" 33 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 34 expclusterv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" 35 "sigs.k8s.io/cluster-api/test/framework" 36 ) 37 38 var ( 39 e2eCtx *shared.E2EContext 40 skipUpgradeTests bool 41 skipGeneralTests bool 42 ) 43 44 func init() { 45 e2eCtx = shared.NewE2EContext(shared.WithManaged(), shared.WithSchemeInit(initScheme)) 46 47 shared.CreateDefaultFlags(e2eCtx) 48 flag.BoolVar(&skipGeneralTests, "skip-eks-general-tests", false, "if true, the general EKS tests will be skipped") 49 flag.BoolVar(&skipUpgradeTests, "skip-eks-upgrade-tests", false, "if true, the EKS upgrade tests will be skipped") 50 } 51 52 func TestE2E(t *testing.T) { 53 RegisterFailHandler(ginkgo.Fail) 54 ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "capa-eks-e2e", []ginkgo.Reporter{framework.CreateJUnitReporterForProw(e2eCtx.Settings.ArtifactFolder)}) 55 } 56 57 var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { 58 return shared.Node1BeforeSuite(e2eCtx) 59 }, func(data []byte) { 60 shared.AllNodesBeforeSuite(e2eCtx, data) 61 }) 62 63 var _ = ginkgo.SynchronizedAfterSuite( 64 func() { 65 shared.AllNodesAfterSuite(e2eCtx) 66 }, 67 func() { 68 shared.Node1AfterSuite(e2eCtx) 69 }, 70 ) 71 72 func runGeneralTests() bool { 73 return !skipGeneralTests 74 } 75 76 func runUpgradeTests() bool { 77 return !skipUpgradeTests 78 } 79 80 func initScheme() *runtime.Scheme { 81 sc := shared.DefaultScheme() 82 _ = expinfrav1.AddToScheme(sc) 83 _ = clusterv1.AddToScheme(sc) 84 _ = ekscontrolplanev1.AddToScheme(sc) 85 _ = expclusterv1.AddToScheme(sc) 86 87 return sc 88 }