Skip to content

Commit

Permalink
wip(e2e) use more modern Kuma setup
Browse files Browse the repository at this point in the history
Set the Kuma version and use a more modern addon builder.

Currently uses an unreleased KTF version.
  • Loading branch information
rainest committed Mar 28, 2024
1 parent 956f457 commit a913d9c
Show file tree
Hide file tree
Showing 3 changed files with 22 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-0.20240327202446-20b270f85f42
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.20240327202446-20b270f85f42 h1:mf06+/5Lvv3+OeLbjA325iOJYvX7joO7iJ0N/Z3/3rs=
github.com/kong/kubernetes-testing-framework v0.39.2-0.20240327202446-20b270f85f42/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
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 a913d9c

Please sign in to comment.