Skip to content

Commit

Permalink
Add test config for upgrades (#166)
Browse files Browse the repository at this point in the history
* Add test config for upgrades

* Update Changelog
  • Loading branch information
erkanerol authored Dec 19, 2023
1 parent 08a300c commit 740f299
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add test config for upgrades to be able to customize timeouts per provider.

## [1.20.2] - 2023-12-13

- Disable Bastion tests for `capa` provider.
Expand Down
22 changes: 17 additions & 5 deletions internal/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ import (
. "github.com/onsi/gomega"
)

func Run() {
type TestConfig struct {
ControlPlaneNodesTimeout time.Duration
WorkerNodesTimeout time.Duration
}

func NewTestConfigWithDefaults() *TestConfig {
return &TestConfig{
ControlPlaneNodesTimeout: 15 * time.Minute,
WorkerNodesTimeout: 15 * time.Minute,
}
}

func Run(cfg *TestConfig) {
Context("upgrade", func() {
var cluster *application.Cluster

Expand All @@ -30,7 +42,7 @@ func Run() {
Expect(err).NotTo(HaveOccurred())

Eventually(wait.Consistent(common.CheckControlPlaneNodesReady(wcClient, int(replicas)), 12, 5*time.Second)).
WithTimeout(15 * time.Minute).
WithTimeout(cfg.ControlPlaneNodesTimeout).
WithPolling(wait.DefaultInterval).
Should(Succeed())
})
Expand All @@ -44,7 +56,7 @@ func Run() {
Expect(err).NotTo(HaveOccurred())

Eventually(wait.Consistent(common.CheckWorkerNodesReady(wcClient, values), 12, 5*time.Second)).
WithTimeout(15 * time.Minute).
WithTimeout(cfg.WorkerNodesTimeout).
WithPolling(wait.DefaultInterval).
Should(Succeed())
})
Expand Down Expand Up @@ -89,7 +101,7 @@ func Run() {
Expect(err).NotTo(HaveOccurred())

Eventually(wait.Consistent(common.CheckControlPlaneNodesReady(wcClient, int(replicas)), 12, 5*time.Second)).
WithTimeout(15 * time.Minute).
WithTimeout(cfg.ControlPlaneNodesTimeout).
WithPolling(wait.DefaultInterval).
Should(Succeed())
})
Expand All @@ -103,7 +115,7 @@ func Run() {
Expect(err).NotTo(HaveOccurred())

Eventually(wait.Consistent(common.CheckWorkerNodesReady(wcClient, values), 12, 5*time.Second)).
WithTimeout(15 * time.Minute).
WithTimeout(cfg.WorkerNodesTimeout).
WithPolling(wait.DefaultInterval).
Should(Succeed())
})
Expand Down
2 changes: 1 addition & 1 deletion providers/capa/upgrade/capa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var _ = Describe("Basic upgrade test", Ordered, func() {
upgrade.Run()
upgrade.Run(upgrade.NewTestConfigWithDefaults())

// Finally run the common tests after upgrade is completed
common.Run(&common.TestConfig{
Expand Down
2 changes: 1 addition & 1 deletion providers/capv/upgrade/capv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var _ = Describe("Basic upgrade test", Ordered, func() {
upgrade.Run()
upgrade.Run(upgrade.NewTestConfigWithDefaults())

// Finally run the common tests after upgrade is completed
common.Run(&common.TestConfig{
Expand Down
10 changes: 9 additions & 1 deletion providers/capvcd/upgrade/capvcd_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
package upgrade

import (
"time"

. "github.com/onsi/ginkgo/v2"

"github.com/giantswarm/cluster-test-suites/internal/common"
"github.com/giantswarm/cluster-test-suites/internal/upgrade"
)

var _ = Describe("Basic upgrade test", Ordered, func() {
upgrade.Run()
// it is better to get defaults at first and then customize
// further changes in defaults will be effective here.
cfg := upgrade.NewTestConfigWithDefaults()
cfg.ControlPlaneNodesTimeout = 30 * time.Minute
cfg.WorkerNodesTimeout = 30 * time.Minute

upgrade.Run(cfg)

// Finally run the common tests after upgrade is completed
common.Run(&common.TestConfig{
Expand Down
2 changes: 1 addition & 1 deletion providers/capz/upgrade/capz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var _ = Describe("Basic upgrade test", Ordered, func() {
upgrade.Run()
upgrade.Run(upgrade.NewTestConfigWithDefaults())

// Finally run the common tests after upgrade is completed
common.Run(&common.TestConfig{
Expand Down
2 changes: 1 addition & 1 deletion providers/eks/upgrade/eks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var _ = Describe("Basic upgrade test", Ordered, func() {
upgrade.Run()
upgrade.Run(upgrade.NewTestConfigWithDefaults())

// Finally run the common tests after upgrade is completed
common.Run(&common.TestConfig{
Expand Down

0 comments on commit 740f299

Please sign in to comment.