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

tests(integration): remove clusterVersion and test skipping code for EOLd k8s versions #4761

Merged
merged 1 commit into from
Sep 29, 2023
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
16 changes: 0 additions & 16 deletions test/integration/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"testing"
"time"

"github.com/blang/semver/v4"
"github.com/kong/go-kong/kong"
"github.com/kong/kubernetes-testing-framework/pkg/clusters"
"github.com/kong/kubernetes-testing-framework/pkg/utils/kubernetes/generators"
Expand Down Expand Up @@ -197,10 +196,6 @@ func TestGRPCIngressEssentials(t *testing.T) {
}

func TestIngressClassNameSpec(t *testing.T) {
if clusterVersion.Major < uint64(2) && clusterVersion.Minor < uint64(19) {
t.Skip("ingress spec tests can not be properly validated against old clusters")
}

t.Parallel()
t.Log("locking IngressClass management")
ingressClassMutex.Lock()
Expand Down Expand Up @@ -351,10 +346,6 @@ func TestIngressNamespaces(t *testing.T) {
}

func TestIngressStatusUpdatesExtended(t *testing.T) {
if clusterVersion.Major == uint64(1) && clusterVersion.Minor < uint64(19) {
t.Skip("status test disabled for old cluster versions")
}

t.Parallel()

ctx := context.Background()
Expand Down Expand Up @@ -485,13 +476,6 @@ func TestIngressStatusUpdatesExtended(t *testing.T) {
func TestIngressClassRegexToggle(t *testing.T) {
RunWhenKongVersion(t, fmt.Sprintf(">=%s", versions.ExplicitRegexPathVersionCutoff), "regex prefixes are only relevant for Kong 3.0+")

// skip the test if the cluster does not support namespaced ingress class parameter (<=1.21).
// since 1.21 is End of Life now.
namespacedIngressClassParameterMinKubernetesVersion := semver.MustParse("1.22.0")
if clusterVersion.LT(namespacedIngressClassParameterMinKubernetesVersion) {
t.Skipf("kubernetes cluster version %s does not support namespaced ingress class parameters", clusterVersion.String())
}

t.Log("locking IngressClass management")
ingressClassMutex.Lock()
t.Cleanup(func() {
Expand Down
9 changes: 4 additions & 5 deletions test/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ func TestMain(m *testing.M) {
builder.WithAddons(metallb.New())

if testenv.ClusterVersion() != "" {
var err error
clusterVersion, err = semver.Parse(strings.TrimPrefix(testenv.ClusterVersion(), "v"))
clusterVersion, err := semver.Parse(strings.TrimPrefix(testenv.ClusterVersion(), "v"))
exitOnErr(ctx, err)

fmt.Printf("INFO: build a new KIND cluster with version %s\n", clusterVersion.String())
Expand All @@ -121,9 +120,6 @@ func TestMain(m *testing.M) {
}
}()

clusterVersion, err = env.Cluster().Version()
exitOnErr(ctx, err)

exitOnErr(ctx, DeployAddonsForCluster(ctx, env.Cluster()))
fmt.Printf("INFO: waiting for cluster %s and all addons to become ready\n", env.Cluster().Name())
envReadyCtx, envReadyCancel := context.WithTimeout(ctx, testenv.EnvironmentReadyTimeout())
Expand Down Expand Up @@ -231,6 +227,9 @@ func TestMain(m *testing.M) {
runInvalidConfigTests = true
}

clusterVersion, err := env.Cluster().Version()
exitOnErr(ctx, err)

fmt.Printf("INFO: testing environment is ready KUBERNETES_VERSION=(%v): running tests\n", clusterVersion)
code = m.Run()

Expand Down
4 changes: 0 additions & 4 deletions test/integration/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/url"
"os"

"github.com/blang/semver/v4"
"github.com/kong/kubernetes-testing-framework/pkg/environments"

"github.com/kong/kubernetes-ingress-controller/v2/test/consts"
Expand All @@ -33,9 +32,6 @@ var (
// proxyUDPURL provides access to the UDP API endpoint for the Kong Addon which is deployed to the test environment's cluster.
proxyUDPURL *url.URL

// clusterVersion is a convenience var where the found version of the env.Cluster is stored.
clusterVersion semver.Version

// runInvalidConfigTests is set to true to run the test cases including invalid test cases.
runInvalidConfigTests bool
)
Expand Down