Skip to content

Commit

Permalink
skip upgrade tests if Kong version below 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Nov 27, 2023
1 parent 52c28f1 commit c6ce507
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"testing"

"github.com/kong/go-kong/kong"
"github.com/kong/kubernetes-testing-framework/pkg/environments"
"github.com/samber/lo"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -84,6 +85,20 @@ func testManifestsUpgrade(
t *testing.T,
testParams manifestsUpgradeTestParams,
) {
// Skip the test if the version of the provides Kong image is too low
// that the version of target image is not be compatible with the already-running KIC.
if kongImageOverride != "" {
kongVersion, err := getKongVersionFromOverrideImageTag()
skipTestVersionRange := kong.MustNewRange("<" + upgradeTestMinimalKongVersion.String())
// If we could not get version from kong image, assume they are latest.
// So we will run the upgrade tests.
if err == nil && skipTestVersionRange(kongVersion) {
t.Skipf("skip upgrade test because Kong version is %s, lower than %s",
kongVersion.String(), upgradeTestMinimalKongVersion.String(),
)
}
}

httpClient := helpers.RetryableHTTPClient(helpers.DefaultHTTPClient())
oldManifest, err := httpClient.Get(testParams.fromManifestURL)
require.NoError(t, err)
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ var (
gatewayDiscoveryMinimalVersion = semver.Version{Major: 2, Minor: 9} // 2.9.0
// adminAPIHTTP2MinimalKongVersion is the minimal version of Kong gateway version that supports `http2` on admin APIs.
adminAPIHTTP2MinimalKongVersion = semver.Version{Major: 3, Minor: 0} // 3.0.0
// upgradeTestMinimalKongVersion is the minimal version of Kong gateway version that enables `TestDeployAndUpgrade*` test cases.
// Since the source Kong version used in TestDeployAndUpgrade* is 3.3, we should enable the test for Kong 3.0.x and above.
upgradeTestMinimalKongVersion = semver.Version{Major: 3, Minor: 0} // 3.0.0
// statusReadyProbeMinimalKongVersion is the minimal version of kong gateway version that enables /status/ready probe.
statusReadyProbeMinimalKongVersion = semver.Version{Major: 3, Minor: 3} // 3.3.0
)
Expand Down

1 comment on commit c6ce507

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Go Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: c6ce507 Previous: 2889365 Ratio
BenchmarkDeckgenGenerateSHA - ns/op 69283 ns/op 29442 ns/op 2.35
BenchmarkDefaultContentToDBLessConfigConverter_Convert - ns/op 139 ns/op 70.84 ns/op 1.96

This comment was automatically generated by workflow using github-action-benchmark.

CC: @Kong/k8s-maintainers

Please sign in to comment.