Skip to content

Commit

Permalink
tests: unskip controlplane upgrade test (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Apr 22, 2024
1 parent 1929b68 commit 5a7e30a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pkg/utils/test/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
// ControlPlaneCondDeadline is the default timeout for checking on controlplane resources.
ControlPlaneCondDeadline = time.Minute
// ControlPlaneCondTick is the default tick for checking on controlplane resources.
ControlPlaneCondTick = time.Second
ControlPlaneCondTick = 250 * time.Millisecond
// ControlPlaneSchedulingTimeLimit is the maximum amount of time to wait for
// a supported ControlPlane to be created after a Gateway resource is
// created
Expand Down
40 changes: 18 additions & 22 deletions test/integration/test_manual_upgrades_and_downgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
originalControlPlaneImageVersion := "3.1.2"
originalControlPlaneImage := fmt.Sprintf("%s:%s", originalControlPlaneImageName, originalControlPlaneImageVersion)

newControlPlaneImageVersion := "3.1.3"
newControlPlaneImage := fmt.Sprintf("%s:%s", originalControlPlaneImageName, newControlPlaneImageVersion)

originalDataPlaneImageName := helpers.GetDefaultDataPlaneBaseImage()
originalDataPlaneImageVersion := "2.7.0"
originalDataPlaneImageVersion := "3.3.0"
originalDataPlaneImage := fmt.Sprintf("%s:%s", originalDataPlaneImageName, originalDataPlaneImageVersion)

newDataPlaneImageVersion := "2.8.0"
newDataPlaneImageVersion := "3.6.0"
newDataPlaneImage := fmt.Sprintf("%s:%s", originalDataPlaneImageName, newDataPlaneImageVersion)

t.Log("deploying a GatewayConfiguration resource")
Expand Down Expand Up @@ -145,7 +148,7 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
return false
}
return container.Image == fmt.Sprintf("%s:%s", originalControlPlaneImageName, originalControlPlaneImageVersion)
}, testutils.ControlPlaneSchedulingTimeLimit, time.Second)
}, testutils.ControlPlaneSchedulingTimeLimit, testutils.ControlPlaneCondTick)

t.Log("verifying that the DataPlane receives the configuration override")
require.Eventually(t, func() bool {
Expand All @@ -170,15 +173,10 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
}, time.Minute, time.Second)

t.Run("upgrade the ControlPlane", func(t *testing.T) {
t.Skip("skipping upgrade test because we do not have a newer image than 3.1.2 to upgrade to, unskip when 3.1.3 or 3.2.0 is out")

newControlPlaneImageVersion := "3.2.0"
newControlPlaneImage := fmt.Sprintf("%s:%s", originalControlPlaneImageName, newControlPlaneImageVersion)

t.Log("upgrading the ControlPlane version for the Gateway")
t.Logf("upgrading the ControlPlane version for the Gateway to %s", newControlPlaneImage)
require.Eventually(t, func() bool {
return changeControlPlaneImage(gatewayConfig, originalControlPlaneImageName, newControlPlaneImageVersion) == nil
}, time.Second*10, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)

t.Log("verifying that the ControlPlane receives the configuration override")
require.Eventually(t, func() bool {
Expand All @@ -194,19 +192,19 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
return false
}
return container.Image == fmt.Sprintf("%s:%s", originalControlPlaneImageName, newControlPlaneImageVersion)
}, testutils.ControlPlaneSchedulingTimeLimit, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)

t.Log("verifying upgraded ControlPlane Pod images for Gateway")
require.Eventually(t, func() bool {
upToDate, err := verifyContainerImageForGateway(gateway, newControlPlaneImage, originalDataPlaneImage)
return err == nil && upToDate
}, time.Minute, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)
})

t.Log("upgrading the DataPlane version for the Gateway")
require.Eventually(t, func() bool {
return changeDataPlaneImage(gatewayConfig, originalDataPlaneImageName, newDataPlaneImageVersion) == nil
}, time.Second*10, time.Second)
}, testutils.DataPlaneCondDeadline, testutils.DataPlaneCondTick)

t.Log("verifying that the DataPlane receives the configuration override")
require.Eventually(t, func() bool {
Expand All @@ -224,19 +222,17 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
return container.Image == fmt.Sprintf("%s:%s", originalDataPlaneImageName, newDataPlaneImageVersion)
}, testutils.GatewayReadyTimeLimit, time.Second)

t.Log("verifying upgraded DataPlane Pod images for Gateway")
t.Log("verifying upgraded DataPlane and ControlPlane Pod images for Gateway")
require.Eventually(t, func() bool {
upToDate, err := verifyContainerImageForGateway(gateway, originalControlPlaneImage, newDataPlaneImage)
upToDate, err := verifyContainerImageForGateway(gateway, newControlPlaneImage, newDataPlaneImage)
return err == nil && upToDate
}, time.Minute, time.Second)

t.Run("downgrade the ControlPlane", func(t *testing.T) {
t.Skip("skipping downagrade because we only have 1 supported image now (3.1.2)")

t.Log("downgrading the ControlPlane version for the Gateway")
require.Eventually(t, func() bool {
return changeControlPlaneImage(gatewayConfig, originalControlPlaneImageName, originalControlPlaneImageVersion) == nil
}, time.Second*10, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)

t.Log("verifying that the ControlPlane receives the configuration override")
require.Eventually(t, func() bool {
Expand All @@ -252,19 +248,19 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
return false
}
return container.Image == fmt.Sprintf("%s:%s", originalControlPlaneImageName, originalControlPlaneImageVersion)
}, testutils.ControlPlaneSchedulingTimeLimit, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)

t.Log("verifying downgraded ControlPlane Pod images for Gateway")
require.Eventually(t, func() bool {
upToDate, err := verifyContainerImageForGateway(gateway, originalControlPlaneImage, newDataPlaneImage)
return err == nil && upToDate
}, time.Minute, time.Second)
}, testutils.ControlPlaneCondDeadline, testutils.ControlPlaneCondTick)
})

t.Log("downgrading the DataPlane version for the Gateway")
require.Eventually(t, func() bool {
return changeDataPlaneImage(gatewayConfig, originalDataPlaneImageName, originalDataPlaneImageVersion) == nil
}, time.Second*10, time.Second)
}, testutils.DataPlaneCondDeadline, testutils.DataPlaneCondTick)

t.Log("verifying that the DataPlane receives the configuration override")
require.Eventually(t, func() bool {
Expand All @@ -286,7 +282,7 @@ func TestManualGatewayUpgradesAndDowngrades(t *testing.T) {
require.Eventually(t, func() bool {
upToDate, err := verifyContainerImageForGateway(gateway, originalControlPlaneImage, originalDataPlaneImage)
return err == nil && upToDate
}, time.Minute, time.Second)
}, testutils.DataPlaneCondDeadline, testutils.DataPlaneCondTick)
}

// verifyContainerImageForGateway indicates whether or not the underlying
Expand Down

0 comments on commit 5a7e30a

Please sign in to comment.