sigs.k8s.io/cluster-api-provider-aws@v1.5.5/test/e2e/suites/unmanaged/unmanaged_CAPI_quick_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 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  
    31  	"sigs.k8s.io/cluster-api-provider-aws/test/e2e/shared"
    32  	capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
    33  )
    34  
    35  var _ = ginkgo.Context("[unmanaged] [Cluster API Framework] [smoke] [PR-Blocking]", func() {
    36  	var (
    37  		namespace         *corev1.Namespace
    38  		ctx               context.Context
    39  		requiredResources *shared.TestResource
    40  	)
    41  
    42  	ginkgo.BeforeEach(func() {
    43  		Expect(e2eCtx.Environment.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. BootstrapClusterProxy can't be nil")
    44  		ctx = context.TODO()
    45  		// Setup a Namespace where to host objects for this spec and create a watcher for the namespace events.
    46  		namespace = shared.SetupSpecNamespace(ctx, "capi-quick-start", e2eCtx)
    47  	})
    48  
    49  	ginkgo.Describe("Running the quick-start spec", func() {
    50  		ginkgo.BeforeEach(func() {
    51  			// 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.
    52  			requiredResources = &shared.TestResource{EC2Normal: 2 * e2eCtx.Settings.InstanceVCPU, IGW: 1, NGW: 1, VPC: 1, ClassicLB: 1, EIP: 3}
    53  			requiredResources.WriteRequestedResources(e2eCtx, "capi-quick-start-test")
    54  			Expect(shared.AcquireResources(requiredResources, config.GinkgoConfig.ParallelNode, flock.New(shared.ResourceQuotaFilePath))).To(Succeed())
    55  		})
    56  		capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput {
    57  			return capi_e2e.QuickStartSpecInput{
    58  				E2EConfig:             e2eCtx.E2EConfig,
    59  				ClusterctlConfigPath:  e2eCtx.Environment.ClusterctlConfigPath,
    60  				BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
    61  				ArtifactFolder:        e2eCtx.Settings.ArtifactFolder,
    62  				SkipCleanup:           e2eCtx.Settings.SkipCleanup,
    63  			}
    64  		})
    65  		ginkgo.AfterEach(func() {
    66  			shared.ReleaseResources(requiredResources, config.GinkgoConfig.ParallelNode, flock.New(shared.ResourceQuotaFilePath))
    67  		})
    68  	})
    69  	ginkgo.AfterEach(func() {
    70  		// Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself.
    71  		shared.DumpSpecResourcesAndCleanup(ctx, "", namespace, e2eCtx)
    72  	})
    73  })