Skip to content

Commit

Permalink
Merge pull request #840 from Danil-Grigorev/updatecli-test-e2e-const
Browse files Browse the repository at this point in the history
[updatecli] Perform replacement of `CAPIVersion` in tests and e2e
  • Loading branch information
salasberryfin authored Nov 8, 2024
2 parents ac5a638 + c017d6a commit 5cae01d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
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

0 comments on commit 5cae01d

Please sign in to comment.