-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* make tests runnable with injection * yoink var into better package * refactor for un/ordered, convert the rest * fix a missed merge conflict * add changelog * oops wrong skip * rename and refactor * clean up and compiler-assert new suite signatures * documentation * documentation * fix my runs * wrap un/ordered in struct for ease of use * Adding changelog file to new location * Deleting changelog file from old location * move changelog * Update test/kubernetes/e2e/tests/glooctl_istio_inject_tests.go * refactor to export less * move and rename suite runner * update readme * rename some more stuff --------- Co-authored-by: Jacob Bohanon <[email protected]> Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8c8747e
commit 4be2838
Showing
40 changed files
with
351 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
changelog: | ||
- type: NON_USER_FACING | ||
issueLink: https://github.com/solo-io/gloo/issues/9353 | ||
resolvesIssue: false | ||
description: >- | ||
Make Kubernetes E2E tests easily importable and runnable from enterprise suites | ||
skipCI-docs-build:true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type ( | ||
NewSuiteFunc func(ctx context.Context, testInstallation *TestInstallation) suite.TestingSuite | ||
|
||
namedSuite struct { | ||
name string | ||
newSuite NewSuiteFunc | ||
} | ||
|
||
orderedSuites struct { | ||
suites []namedSuite | ||
} | ||
|
||
suites struct { | ||
suites map[string]NewSuiteFunc | ||
} | ||
|
||
// A SuiteRunner is an interface that allows E2E tests to simply Register tests in one location and execute them | ||
// with Run. | ||
SuiteRunner interface { | ||
Run(ctx context.Context, t *testing.T, testInstallation *TestInstallation) | ||
Register(name string, newSuite NewSuiteFunc) | ||
} | ||
) | ||
|
||
var ( | ||
_ SuiteRunner = new(orderedSuites) | ||
_ SuiteRunner = new(suites) | ||
) | ||
|
||
// NewSuiteRunner returns an implementation of TestRunner that will execute tests as specified | ||
// in the ordered parameter. | ||
// | ||
// NOTE: it should be strongly preferred to use unordered tests. Only pass true to this function | ||
// if there is a clear need for the tests to be ordered, and specify in a comment near the call | ||
// to NewSuiteRunner why the tests need to be ordered. | ||
func NewSuiteRunner(ordered bool) SuiteRunner { | ||
if ordered { | ||
return new(orderedSuites) | ||
} | ||
|
||
return new(suites) | ||
} | ||
|
||
func (o orderedSuites) Run(ctx context.Context, t *testing.T, testInstallation *TestInstallation) { | ||
for _, namedTest := range o.suites { | ||
t.Run(namedTest.name, func(t *testing.T) { | ||
suite.Run(t, namedTest.newSuite(ctx, testInstallation)) | ||
}) | ||
} | ||
} | ||
|
||
func (o *orderedSuites) Register(name string, newSuite NewSuiteFunc) { | ||
if o.suites == nil { | ||
o.suites = make([]namedSuite, 0) | ||
} | ||
o.suites = append(o.suites, namedSuite{ | ||
name: name, | ||
newSuite: newSuite, | ||
}) | ||
|
||
} | ||
|
||
func (u suites) Run(ctx context.Context, t *testing.T, testInstallation *TestInstallation) { | ||
// TODO(jbohanon) does some randomness need to be injected here to ensure they aren't run in the same order every time? | ||
// from https://goplay.tools/snippet/A-qqQCWkFaZ it looks like maps are not stable, but tend toward stability. | ||
for testName, newSuite := range u.suites { | ||
t.Run(testName, func(t *testing.T) { | ||
suite.Run(t, newSuite(ctx, testInstallation)) | ||
}) | ||
} | ||
} | ||
|
||
func (u *suites) Register(name string, newSuite NewSuiteFunc) { | ||
if u.suites == nil { | ||
u.suites = make(map[string]NewSuiteFunc) | ||
} | ||
u.suites[name] = newSuite | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/kubernetes/e2e/tests/automtls_istio_edge_api_tests.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package tests | ||
|
||
import ( | ||
"github.com/solo-io/gloo/test/kubernetes/e2e" | ||
"github.com/solo-io/gloo/test/kubernetes/e2e/features/headless_svc" | ||
"github.com/solo-io/gloo/test/kubernetes/e2e/features/istio" | ||
) | ||
|
||
func AutomtlsIstioEdgeApiSuiteRunner() e2e.SuiteRunner { | ||
automtlsIstioEdgeApiSuiteRunner := e2e.NewSuiteRunner(false) | ||
|
||
automtlsIstioEdgeApiSuiteRunner.Register("HeadlessSvc", headless_svc.NewEdgeGatewayHeadlessSvcSuite) | ||
automtlsIstioEdgeApiSuiteRunner.Register("IstioIntegrationAutoMtls", istio.NewGlooIstioAutoMtlsSuite) | ||
|
||
return automtlsIstioEdgeApiSuiteRunner | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.