Skip to content

Commit

Permalink
test: enable HTTPS redirect tests with expression router (#4614)
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Sep 6, 2023
1 parent 66598d5 commit d781042
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/integration/ingress_https_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
)

func TestHTTPSRedirect(t *testing.T) {
// kong does not support HTTPS redirect yet.
skipTestForExpressionRouter(t)
// Kong starts to support HTTPS redirect in expression router from 3.4.0.
RunWhenKongExpressionRouterWithVersion(t, ">=3.4.0")
ctx := context.Background()

t.Parallel()
Expand Down
14 changes: 14 additions & 0 deletions test/internal/helpers/kong.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ func GetKongDBMode(proxyAdminURL *url.URL, kongTestPassword string) (string, err

// GetKongRouterFlavor gets router flavor of Kong using the provided Admin API URL.
func GetKongRouterFlavor(proxyAdminURL *url.URL, kongTestPassword string) (string, error) {
const (
// ExpressionRouterMinMajorVersion is the lowest major version of Kong that supports expression router.
// Kong below this version supports only "traditional" router, and does not contain "router_flavor" field in root configuration.
ExpressionRouterMinMajorVersion = 3
)
kongVersion, err := GetKongVersion(proxyAdminURL, kongTestPassword)
if err != nil {
return "", err
}

if kongVersion.Major() < ExpressionRouterMinMajorVersion {
return "traditional", nil
}

jsonResp, err := GetKongRootConfig(proxyAdminURL, kongTestPassword)
if err != nil {
return "", err
Expand Down

0 comments on commit d781042

Please sign in to comment.