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: pin Kuma version in E2E tests (#5562) #5748

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/kong/deck v1.26.1
github.com/kong/go-kong v0.48.0
github.com/kong/kubernetes-telemetry v0.1.1
github.com/kong/kubernetes-testing-framework v0.39.1
github.com/kong/kubernetes-testing-framework v0.39.2-0.20240327101738-75adbf4b13c7
github.com/lithammer/dedent v1.1.0
github.com/miekg/dns v1.1.56
github.com/mitchellh/mapstructure v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ github.com/kong/go-kong v0.48.0 h1:vK1OpoxO50qlKdwPfmx9ChvkTKRsoCCB3b3iHo1umLc=
github.com/kong/go-kong v0.48.0/go.mod h1:qH4CEFqT83ywmu1TlMZX09clQH4B8/dX88CtT/jdv/E=
github.com/kong/kubernetes-telemetry v0.1.1 h1:q8iABCuonO16p5q6QVygr7J39G5o5jK5Y3w3ZlE8JC4=
github.com/kong/kubernetes-telemetry v0.1.1/go.mod h1:0yzRZVPwKeOQUFMWbROEJzUE1z8WWngWiujoYtdEEPA=
github.com/kong/kubernetes-testing-framework v0.39.1 h1:30dTVe0Muda3r6NAMQHvdGLuB+nkhZRXnJA8AJjuvO4=
github.com/kong/kubernetes-testing-framework v0.39.1/go.mod h1:12TQ5gAkZhuxh47IJcW03iumky1X/T7ZCStuClQ1vzs=
github.com/kong/kubernetes-testing-framework v0.39.2-0.20240327101738-75adbf4b13c7 h1:O4Kc5Jxnoe/LPL36AQCPteLfxW0uBNPY+f26uXBEg6Q=
github.com/kong/kubernetes-testing-framework v0.39.2-0.20240327101738-75adbf4b13c7/go.mod h1:12TQ5gAkZhuxh47IJcW03iumky1X/T7ZCStuClQ1vzs=
github.com/kong/semver/v4 v4.0.1 h1:DIcNR8W3gfx0KabFBADPalxxsp+q/5COwIFkkhrFQ2Y=
github.com/kong/semver/v4 v4.0.1/go.mod h1:LImQ0oT15pJvSns/hs2laLca2zcYoHu5EsSNY0J6/QA=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ func deployIngressWithEchoBackends(ctx context.Context, t *testing.T, env enviro

t.Logf("exposing deployment %s via service", deployment.Name)
service := generators.NewServiceForDeployment(deployment, corev1.ServiceTypeClusterIP)
for i := range service.Spec.Ports {
// Set Service's appProtocol to http so that Kuma load-balances requests on HTTP-level instead of TCP.
// TCP load-balancing proved to cause issues with not distributing load evenly in short time spans like in this test.
// Ref: https://github.com/Kong/kubernetes-ingress-controller/issues/5498
service.Spec.Ports[i].AppProtocol = lo.ToPtr("http")
}

_, err = env.Cluster().Client().CoreV1().Services(corev1.NamespaceDefault).Create(ctx, service, metav1.CreateOptions{})
require.NoError(t, err)

Expand Down
19 changes: 17 additions & 2 deletions test/e2e/kuma_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"testing"

"github.com/blang/semver/v4"
"github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/kuma"
"github.com/kong/kubernetes-testing-framework/pkg/environments"
"github.com/stretchr/testify/require"
Expand All @@ -18,7 +19,7 @@ import (
func TestDeployAllInOneDBLESSKuma(t *testing.T) {
t.Log("configuring all-in-one-dbless.yaml manifest test")
t.Parallel()
ctx, env := setupE2ETest(t, kuma.New())
ctx, env := setupE2ETest(t, buildKumaAddon(t))

t.Log("deploying kong components")
manifest := getDBLessTestManifestByControllerImageEnv(t)
Expand All @@ -41,7 +42,7 @@ func TestDeployAllInOnePostgresKuma(t *testing.T) {
t.Log("configuring all-in-one-postgres.yaml manifest test")
t.Parallel()

ctx, env := setupE2ETest(t, kuma.New())
ctx, env := setupE2ETest(t, buildKumaAddon(t))

t.Log("deploying kong components")
deployments := ManifestDeploy{Path: postgresPath}.Run(ctx, t, env)
Expand All @@ -64,6 +65,20 @@ func TestDeployAllInOnePostgresKuma(t *testing.T) {
verifyIngressWithEchoBackends(ctx, t, env, numberOfEchoBackends)
}

// buildKumaAddon returns a Kuma addon with mTLS enabled and the version specified in the test dependencies file.
func buildKumaAddon(t *testing.T) *kuma.Addon {
const rawKumaVersion = "2.5.4"

kumaVersion, err := semver.Parse(rawKumaVersion)
require.NoError(t, err)

t.Logf("Installing Kuma addon, version=%s", kumaVersion)
return kuma.NewBuilder().
WithMTLS().
WithVersion(kumaVersion).
Build()
}

func verifyKuma(ctx context.Context, t *testing.T, env environments.Environment) {
svcClient := env.Cluster().Client().CoreV1().Services(corev1.NamespaceDefault)
const svcName = "echo"
Expand Down
Loading