sigs.k8s.io/cluster-api-provider-aws@v1.5.5/test/e2e/suites/unmanaged/unmanaged_CAPI_quick_clusterclass_test.go (about) 1 //go:build e2e 2 // +build e2e 3 4 /* 5 Copyright 2021 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 unmanaged 21 22 import ( 23 "context" 24 25 "github.com/gofrs/flock" 26 "github.com/onsi/ginkgo" 27 "github.com/onsi/ginkgo/config" 28 . "github.com/onsi/gomega" 29 corev1 "k8s.io/api/core/v1" 30 "k8s.io/utils/pointer" 31 32 "sigs.k8s.io/cluster-api-provider-aws/test/e2e/shared" 33 capi_e2e "sigs.k8s.io/cluster-api/test/e2e" 34 ) 35 36 var _ = ginkgo.Context("[unmanaged] [Cluster API Framework] [smoke]", func() { 37 var ( 38 namespace *corev1.Namespace 39 ctx context.Context 40 requiredResources *shared.TestResource 41 ) 42 43 ginkgo.BeforeEach(func() { 44 Expect(e2eCtx.Environment.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. BootstrapClusterProxy can't be nil") 45 ctx = context.TODO() 46 // Setup a Namespace where to host objects for this spec and create a watcher for the namespace events. 47 namespace = shared.SetupSpecNamespace(ctx, "capi-quick-start", e2eCtx) 48 }) 49 50 ginkgo.Describe("Running the quick-start spec with ClusterClass", func() { 51 ginkgo.BeforeEach(func() { 52 // As the resources cannot be defined by the It() clause in CAPI tests, using the largest values required for all It() tests in this CAPI test. 53 requiredResources = &shared.TestResource{EC2Normal: 2 * e2eCtx.Settings.InstanceVCPU, IGW: 1, NGW: 1, VPC: 1, ClassicLB: 1, EIP: 3} 54 requiredResources.WriteRequestedResources(e2eCtx, "capi-quick-start-clusterclass-test") 55 Expect(shared.AcquireResources(requiredResources, config.GinkgoConfig.ParallelNode, flock.New(shared.ResourceQuotaFilePath))).To(Succeed()) 56 }) 57 capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput { 58 return capi_e2e.QuickStartSpecInput{ 59 E2EConfig: e2eCtx.E2EConfig, 60 ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, 61 BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, 62 ArtifactFolder: e2eCtx.Settings.ArtifactFolder, 63 SkipCleanup: e2eCtx.Settings.SkipCleanup, 64 Flavor: pointer.String(shared.TopologyFlavor), 65 } 66 }) 67 ginkgo.AfterEach(func() { 68 _ = shared.ReleaseResources(requiredResources, config.GinkgoConfig.ParallelNode, flock.New(shared.ResourceQuotaFilePath)) 69 }) 70 }) 71 ginkgo.AfterEach(func() { 72 // Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself. 73 shared.DumpSpecResourcesAndCleanup(ctx, "", namespace, e2eCtx) 74 }) 75 })