Skip to content

Commit

Permalink
chore(tests) upgrade KTF (#5760)
Browse files Browse the repository at this point in the history
Upgrade KTF to a 0.39 release with some Kuma addon backports.

Set the Kuma version and use a more modern addon builder.

---

Co-authored-by: Tao Yi <tao.yi@konghq.com>
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>
  • Loading branch information
3 people committed Apr 4, 2024
1 parent 956f457 commit d5f7a16
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
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
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 h1:sEswj0Bs9COlJZaWxc5/jRp+Qq5lF3ieS2c0F8vWc+s=
github.com/kong/kubernetes-testing-framework v0.39.2/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
6 changes: 6 additions & 0 deletions test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,12 @@ 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
21 changes: 19 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,22 @@ func TestDeployAllInOnePostgresKuma(t *testing.T) {
verifyIngressWithEchoBackends(ctx, t, env, numberOfEchoBackends)
}

// rawKumaVersion is the Kuma version used for E2E tests. This is pinned in the 2.12.x LTS branch because it does
// not have Renovate set up.
const rawKumaVersion = "2.6.2"

// buildKumaAddon returns a Kuma addon with mTLS enabled and the version specified in the test dependencies file.
func buildKumaAddon(t *testing.T) *kuma.Addon {
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

0 comments on commit d5f7a16

Please sign in to comment.