Skip to content

Commit 816cdf0

Browse files
committed
e2e: fix scheme and target contract in upgrade tests
1 parent acf4708 commit 816cdf0

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

test/e2e/clusterctl_upgrade_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
. "github.com/onsi/gomega"
2626
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2727
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
28+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2"
2829
clusterctlcluster "sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
2930
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
3031
"sigs.k8s.io/cluster-api/test/framework"
@@ -73,7 +74,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.13
7374
InitWithIPAMProviders: []string{},
7475
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
7576
{ // Upgrade to latest v1beta1.
76-
Contract: clusterv1beta1.GroupVersion.Version,
77+
Contract: clusterv1.GroupVersion.Version,
7778
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
7879
framework.ValidateCRDMigration(ctx, proxy, namespace, clusterName,
7980
crdShouldBeMigrated, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
@@ -100,7 +101,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.13
100101
})
101102

102103
// Note: This test should be changed during "prepare main branch", it should test CAPV n-1 => current (and then corresponding CAPI versions if already available).
103-
var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.13=>current, CAPI 1.10=>1.11) [vcsim] [supervisor] [ClusterClass]", func() {
104+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.13=>current, CAPI 1.10=>1.11) [vcsim] [supervisor] [ClusterClass]", Label("Foo"), func() {
104105
const specName = "clusterctl-upgrade-1.12-current" // prefix (clusterctl-upgrade) copied from CAPI
105106
Setup(specName, func(testSpecificSettingsGetter func() testSettings) {
106107
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
@@ -127,7 +128,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.13
127128
InitWithIPAMProviders: []string{},
128129
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
129130
{ // Upgrade to latest v1beta1.
130-
Contract: clusterv1beta1.GroupVersion.Version,
131+
Contract: clusterv1.GroupVersion.Version,
131132
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
132133
framework.ValidateCRDMigration(ctx, proxy, namespace, clusterName,
133134
crdShouldBeMigrated, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
@@ -181,7 +182,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.12
181182
InitWithIPAMProviders: []string{},
182183
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
183184
{ // Upgrade to latest v1beta1.
184-
Contract: clusterv1beta1.GroupVersion.Version,
185+
Contract: clusterv1.GroupVersion.Version,
185186
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
186187
framework.ValidateCRDMigration(ctx, proxy, namespace, clusterName,
187188
crdShouldBeMigrated, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
@@ -235,7 +236,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.11
235236
InitWithIPAMProviders: []string{},
236237
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
237238
{ // Upgrade to latest v1beta1.
238-
Contract: clusterv1beta1.GroupVersion.Version,
239+
Contract: clusterv1.GroupVersion.Version,
239240
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
240241
framework.ValidateCRDMigration(ctx, proxy, namespace, clusterName,
241242
crdShouldBeMigrated, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
@@ -268,10 +269,14 @@ func getStableReleaseOfMinor(ctx context.Context, releaseMarkerPrefix, minorRele
268269
}
269270

270271
func kindManagementClusterNewClusterProxyFunc(name string, kubeconfigPath string) framework.ClusterProxy {
272+
scheme := initScheme()
273+
// The scheme for v1beta1 is still required as long as we upgrade from v1beta1 Cluster's.
274+
_ = clusterv1beta1.AddToScheme(scheme)
275+
271276
if testTarget == VCSimTestTarget {
272-
return vcsim.NewClusterProxy(name, kubeconfigPath, initScheme())
277+
return vcsim.NewClusterProxy(name, kubeconfigPath, scheme)
273278
}
274-
return framework.NewClusterProxy(name, kubeconfigPath, initScheme())
279+
return framework.NewClusterProxy(name, kubeconfigPath, scheme)
275280
}
276281

277282
func crdShouldBeMigrated(crd apiextensionsv1.CustomResourceDefinition) bool {

0 commit comments

Comments
 (0)