Skip to content

Commit

Permalink
test(enterprise) use a static password
Browse files Browse the repository at this point in the history
Simplify test RBAC environment by just always using a static password.
The test doesn't need actual security, and the main qualities its
password needs is (a) to exist and allow RBAC testing at all and (b) to
be obvious to the tester during manual runs, in case test failures
require manual inspection of the admin API to clear.
  • Loading branch information
Travis Raines committed Oct 11, 2021
1 parent 2aa5b20 commit e7306db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
10 changes: 1 addition & 9 deletions test/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/kong/kubernetes-testing-framework/pkg/clusters/types/kind"
"github.com/kong/kubernetes-testing-framework/pkg/environments"
"github.com/kong/kubernetes-testing-framework/pkg/utils/kubernetes/generators"
"github.com/sethvargo/go-password/password"

testutils "github.com/kong/kubernetes-ingress-controller/test/utils"
)
Expand All @@ -44,17 +43,10 @@ func TestMain(m *testing.M) {
if licenseJSON == "" {
exitOnErr(fmt.Errorf(("KONG_LICENSE_DATA must be set for Enterprise tests")))
}
password, err := password.Generate(10, 5, 0, false, false)
if err != nil {
kongAdminPwd = KongTestPassword
} else {
kongAdminPwd = password
}
extraControllerArgs = append(extraControllerArgs, fmt.Sprintf("--kong-admin-token=%s", kongAdminPwd))
extraControllerArgs = append(extraControllerArgs, "--kong-workspace=notdefault")
fmt.Printf("INFO: using Kong admin password %s\n", kongAdminPwd)
kongbuilder = kongbuilder.WithProxyEnterpriseEnabled(licenseJSON).
WithProxyEnterpriseSuperAdminPassword(kongAdminPwd).
WithProxyEnterpriseSuperAdminPassword(kongTestPassword).
WithProxyAdminServiceTypeLoadBalancer()
}

Expand Down
5 changes: 3 additions & 2 deletions test/integration/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ const (
// problems setting up the testing environment and/or cluster.
ExitCodeEnvSetupFailed = 104

// Kong Admin test password
KongTestPassword = "password"
// kongTestPassword is used as a password only within the context of transient integration test runs
// and is left static to help developers debug failures in those testing environments.
kongTestPassword = "password"
)

// -----------------------------------------------------------------------------
Expand Down

0 comments on commit e7306db

Please sign in to comment.