-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add cluster-upgrade test with Runtime SDK
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package e2e | ||
|
||
import ( | ||
"github.com/blang/semver/v4" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"k8s.io/utils/ptr" | ||
clusterctlcluster "sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster" | ||
capi_e2e "sigs.k8s.io/cluster-api/test/e2e" | ||
"sigs.k8s.io/cluster-api/test/framework" | ||
) | ||
|
||
var _ = Describe("When upgrading a workload cluster using ClusterClass with RuntimeSDK [vcsim] [supervisor] [ClusterClass]", func() { | ||
const specName = "k8s-upgrade-with-runtimesdk" // aligned to CAPI | ||
Setup(specName, func(testSpecificSettingsGetter func() testSettings) { | ||
capi_e2e.ClusterUpgradeWithRuntimeSDKSpec(ctx, func() capi_e2e.ClusterUpgradeWithRuntimeSDKSpecInput { | ||
version, err := semver.ParseTolerant(e2eConfig.GetVariable(capi_e2e.KubernetesVersionUpgradeFrom)) | ||
Expect(err).ToNot(HaveOccurred(), "Invalid argument, KUBERNETES_VERSION_UPGRADE_FROM is not a valid version") | ||
if version.LT(semver.MustParse("1.24.0")) { | ||
Fail("This test only supports upgrades from Kubernetes >= v1.24.0") | ||
} | ||
|
||
return capi_e2e.ClusterUpgradeWithRuntimeSDKSpecInput{ | ||
E2EConfig: e2eConfig, | ||
ClusterctlConfigPath: testSpecificSettingsGetter().ClusterctlConfigPath, | ||
BootstrapClusterProxy: bootstrapClusterProxy, | ||
ArtifactFolder: artifactFolder, | ||
SkipCleanup: skipCleanup, | ||
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) { | ||
// This check ensures that the resourceVersions are stable, i.e. it verifies there are no | ||
// continuous reconciles when everything should be stable. | ||
framework.ValidateResourceVersionStable(ctx, proxy, namespace, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName)) | ||
}, | ||
// "upgrades-runtimesdk" is the same as the "topology" flavor but with an additional RuntimeExtension. | ||
Flavor: ptr.To(testSpecificSettingsGetter().FlavorForMode("upgrades-runtimesdk")), | ||
ExtensionNamespace: "capv-test-extension-system", | ||
ExtensionServiceName: "capv-test-extension-webhook-service", | ||
} | ||
}) | ||
}) | ||
}) |