Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[updatecli] Perform replacement of CAPIVersion in tests and e2e #840

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/sync/provider_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ import (
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
)

const (
CAPIVersion = "v1.7.7"
)

var _ = Describe("Provider sync", func() {
var (
err error
Expand Down Expand Up @@ -160,7 +164,7 @@ var _ = Describe("Provider sync", func() {
s := sync.NewProviderSync(testEnv, capiProvider.DeepCopy())

expected := capiProvider.DeepCopy()
expected.Spec.Version = "v1.7.7"
expected.Spec.Version = CAPIVersion

Eventually(func(g Gomega) {
g.Expect(s.Get(ctx)).To(Succeed())
Expand Down Expand Up @@ -254,7 +258,7 @@ var _ = Describe("Provider sync", func() {
s := sync.NewProviderSync(testEnv, capiProvider.DeepCopy())

expected := capiProvider.DeepCopy()
expected.Spec.Version = "v1.7.7"
expected.Spec.Version = CAPIVersion

Eventually(func(g Gomega) {
g.Expect(s.Get(ctx)).To(Succeed())
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,7 @@ const (
CapiClusterOwnerNamespaceLabel = "cluster-api.cattle.io/capi-cluster-owner-ns"
OwnedLabelName = "cluster-api.cattle.io/owned"
)

const (
CAPIVersion = "v1.7.7"
)
6 changes: 3 additions & 3 deletions test/e2e/suites/chart-upgrade/chart_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ var _ = Describe("Chart upgrade functionality should work", Label(e2e.ShortTestL
upgradeInput.PostUpgradeSteps = append(upgradeInput.PostUpgradeSteps, func() {
framework.WaitForCAPIProviderRollout(ctx, framework.WaitForCAPIProviderRolloutInput{
Getter: setupClusterResult.BootstrapClusterProxy.GetClient(),
Version: "v1.7.7",
Version: e2e.CAPIVersion,
Name: "cluster-api",
Namespace: "capi-system",
}, e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers")...)
}, func() {
framework.WaitForCAPIProviderRollout(ctx, framework.WaitForCAPIProviderRolloutInput{
Getter: setupClusterResult.BootstrapClusterProxy.GetClient(),
Version: "v1.7.7",
Version: e2e.CAPIVersion,
Name: "kubeadm-control-plane",
Namespace: "capi-kubeadm-control-plane-system",
}, e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers")...)
}, func() {
framework.WaitForCAPIProviderRollout(ctx, framework.WaitForCAPIProviderRolloutInput{
Getter: setupClusterResult.BootstrapClusterProxy.GetClient(),
Version: "v1.7.7",
Version: e2e.CAPIVersion,
Name: "docker",
Namespace: "capd-system",
}, e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers")...)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suites/update-labels/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var _ = BeforeSuite(func() {
Tag: e2eConfig.GetVariable(e2e.TurtlesVersionVar),
WaitDeploymentsReadyInterval: e2eConfig.GetIntervals(setupClusterResult.BootstrapClusterProxy.GetName(), "wait-controllers"),
AdditionalValues: map[string]string{
"cluster-api-operator.cluster-api.version": "v1.7.7",
"cluster-api-operator.cluster-api.version": e2e.CAPIVersion,
"rancherTurtles.features.rancher-kubeconfigs.label": "true", // force to be true even if the default in the chart changes
},
}
Expand Down
18 changes: 18 additions & 0 deletions updatecli/updatecli.d/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ targets:
replacepattern: 'https://github.com/rancher-sandbox/cluster-api/releases/{{ source "capirelease" }}/'
scmid: turtles
sourceid: capirelease # Will be ignored as `replacepattern` is specified
bumpcapi-tests:
name: bump core capi in tests package
kind: file
spec:
file: ./internal/sync/provider_sync_test.go
matchpattern: 'CAPIVersion = .*'
replacepattern: CAPIVersion = "{{ source "capirelease" }}"
scmid: turtles
sourceid: capirelease # Will be ignored as `replacepattern` is specified
bumpcapi-e2e:
name: bump core capi in e2e package
kind: file
spec:
file: ./test/e2e/const.go
matchpattern: 'CAPIVersion = .*'
replacepattern: CAPIVersion = "{{ source "capirelease" }}"
scmid: turtles
sourceid: capirelease # Will be ignored as `replacepattern` is specified
bumpcaprke2:
name: bump caprke2 provider
kind: file
Expand Down
Loading