|
| 1 | +//go:build e2e |
| 2 | +// +build e2e |
| 3 | + |
| 4 | +/* |
| 5 | +Copyright 2025 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 | + "context" |
| 24 | + "fmt" |
| 25 | + |
| 26 | + "github.com/onsi/ginkgo/v2" |
| 27 | + . "github.com/onsi/gomega" |
| 28 | + "k8s.io/utils/ptr" |
| 29 | + |
| 30 | + ekscontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/v2/controlplane/eks/api/v1beta2" |
| 31 | + "sigs.k8s.io/cluster-api-provider-aws/v2/test/e2e/shared" |
| 32 | + capi_e2e "sigs.k8s.io/cluster-api/test/e2e" |
| 33 | + "sigs.k8s.io/cluster-api/test/framework/clusterctl" |
| 34 | + "sigs.k8s.io/cluster-api/util" |
| 35 | +) |
| 36 | + |
| 37 | +var _ = ginkgo.Describe("[managed] [general] [nodeadm] EKS nodeadm ClusterClass tests", func() { |
| 38 | + const specName = "cluster" |
| 39 | + var ( |
| 40 | + ctx context.Context |
| 41 | + clusterName string |
| 42 | + ) |
| 43 | + |
| 44 | + ginkgo.BeforeEach(func() { |
| 45 | + ctx = context.TODO() |
| 46 | + |
| 47 | + if !runGeneralTests() { |
| 48 | + ginkgo.Skip("skipping due to unmet condition") |
| 49 | + } |
| 50 | + |
| 51 | + ginkgo.By("should have a valid test configuration") |
| 52 | + Expect(e2eCtx.Environment.BootstrapClusterProxy).ToNot(BeNil(), "BootstrapClusterProxy can't be nil") |
| 53 | + Expect(e2eCtx.E2EConfig).ToNot(BeNil(), "E2EConfig can't be nil") |
| 54 | + Expect(e2eCtx.E2EConfig.Variables).To(HaveKey(shared.KubernetesVersion)) |
| 55 | + Expect(e2eCtx.E2EConfig.Variables).To(HaveKey(shared.CNIAddonVersion)) |
| 56 | + |
| 57 | + clusterName = fmt.Sprintf("%s-%s", specName, util.RandomString(6)) |
| 58 | + |
| 59 | + ginkgo.By("default iam role should exist") |
| 60 | + VerifyRoleExistsAndOwned(ctx, ekscontrolplanev1.DefaultEKSControlPlaneRole, "", false, e2eCtx.AWSSession) |
| 61 | + }) |
| 62 | + |
| 63 | + capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput { |
| 64 | + return capi_e2e.QuickStartSpecInput{ |
| 65 | + E2EConfig: e2eCtx.E2EConfig, |
| 66 | + ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, |
| 67 | + BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, |
| 68 | + ArtifactFolder: e2eCtx.Settings.ArtifactFolder, |
| 69 | + SkipCleanup: e2eCtx.Settings.SkipCleanup, |
| 70 | + Flavor: ptr.To(EKSNodeadmClusterClassFlavor), |
| 71 | + ClusterName: ptr.To(clusterName), |
| 72 | + WorkerMachineCount: ptr.To(int64(3)), |
| 73 | + ControlPlaneWaiters: clusterctl.ControlPlaneWaiters{ |
| 74 | + WaitForControlPlaneInitialized: WaitForEKSControlPlaneInitialized, |
| 75 | + WaitForControlPlaneMachinesReady: WaitForEKSControlPlaneMachinesReady, |
| 76 | + }, |
| 77 | + } |
| 78 | + }) |
| 79 | +}) |
0 commit comments