-
Notifications
You must be signed in to change notification settings - Fork 857
feat(e2e-tests): all suites run in one test #7082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+151
−0
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| test: | ||
| go test --godog.tags='@ModelDeployment,@CustomModelSpec' --godog.concurrency=3 -race | ||
|
|
||
| debug: | ||
| go test --godog.tags='@0' --godog.concurrency=1 -race | ||
|
|
||
| test-all: | ||
| cd cicd && go test -race |
This file contains hidden or 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,12 @@ | ||
| { | ||
| "namespace": "seldon-mesh", | ||
| "log_level": "debug", | ||
| "skip_cleanup" : false, | ||
| "skip_cleanup_on_error": false, | ||
| "inference" : { | ||
| "host": "localhost", | ||
| "httpPort": 9000, | ||
| "grpcPort": 9000, | ||
| "ssl": false | ||
| } | ||
| } |
This file contains hidden or 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,103 @@ | ||
| package cicd__test | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "testing" | ||
|
|
||
| "github.com/cucumber/godog" | ||
| "github.com/cucumber/godog/colors" | ||
| "github.com/seldonio/seldon-core/tests/integration/godog/suite" | ||
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| const cmdOptPrefix = "godog." | ||
|
|
||
| var opts = godog.Options{ | ||
| Output: colors.Colored(os.Stdout), | ||
| Format: "pretty", | ||
| } | ||
|
|
||
| func init() { | ||
| godog.BindCommandLineFlags(cmdOptPrefix, &opts) | ||
| } | ||
|
|
||
| type suiteCfg struct { | ||
| Name string | ||
| Path string | ||
| Tags string | ||
| Concurrency int | ||
| } | ||
|
|
||
| func runOne(name string, o godog.Options) int { | ||
| s := godog.TestSuite{ | ||
| Name: name, | ||
| TestSuiteInitializer: suite.InitializeTestSuite, | ||
| ScenarioInitializer: suite.InitializeScenario, | ||
| Options: &o, | ||
| } | ||
| return s.Run() | ||
| } | ||
|
|
||
| // TestMain todo: this is the future version of running all test cases for the test suite with defined suites and config | ||
| // todo: in the future we could read the file from config instead of having it defined | ||
| // todo: we need to add custom stats for the end summarizing all suits run and have possible retries in the test suite | ||
| // At the moment if it receives any flags such as paths or tags it runs only one test suite | ||
| func TestMain(m *testing.M) { | ||
| flagSet := pflag.CommandLine | ||
| flagSet.StringSliceVar(&opts.Paths, fmt.Sprintf("%s%s", cmdOptPrefix, "paths"), []string{}, "paths to feature files") | ||
| pflag.Parse() | ||
|
|
||
| // Decide mode: | ||
| // - If user explicitly provided --godog.paths OR --godog.tags, treat it as a custom run. | ||
| // (You can expand this condition if you want other flags to trigger “custom mode”.) | ||
| custom := pflag.CommandLine.Changed(cmdOptPrefix+"paths") || pflag.CommandLine.Changed(cmdOptPrefix+"tags") | ||
|
|
||
| godogStatus := 0 | ||
|
|
||
| if custom { | ||
| // Custom: run exactly what the user requested (one suite) | ||
| godogStatus = runOne("godog-normal-run", opts) | ||
| } else { | ||
| // Aggregated default: run all suites (Option A) | ||
| suites := []suiteCfg{ | ||
| {Name: "model-setup", Path: "../features/model", Tags: "@ServerSetup", Concurrency: 3}, | ||
| {Name: "model-run", Path: "../features/model", Tags: "~@ServerSetup", Concurrency: 3}, | ||
|
|
||
| {Name: "autoscaling-setup", Path: "../features/autoscaling", Tags: "@ServerSetup", Concurrency: 3}, | ||
| {Name: "autoscaling-run", Path: "../features/autoscaling", Tags: "~@ServerSetup", Concurrency: 3}, | ||
|
|
||
| {Name: "experiment-setup", Path: "../features/experiment", Tags: "@ServerSetup", Concurrency: 3}, | ||
| {Name: "experiment-run", Path: "../features/experiment", Tags: "~@ServerSetup", Concurrency: 3}, | ||
|
|
||
| {Name: "pipeline-setup", Path: "../features/pipeline", Tags: "@ServerSetup", Concurrency: 3}, | ||
| {Name: "pipeline-run", Path: "../features/pipeline", Tags: "~@ServerSetup", Concurrency: 3}, | ||
| } | ||
|
|
||
| failed := 0 | ||
| for _, s := range suites { | ||
| o := opts // copy base opts (format/output/etc) | ||
| o.Paths = []string{s.Path} | ||
| o.Tags = s.Tags | ||
| o.Concurrency = s.Concurrency | ||
|
|
||
| fmt.Printf("\n=== Running Godog suite: %s path=%s tags=%q ===\n", s.Name, s.Path, s.Tags) | ||
| if st := runOne(s.Name, o); st != 0 { | ||
| failed++ | ||
| } | ||
| } | ||
|
|
||
| fmt.Printf("\n=== Godog overall: %d/%d suites failed ===\n", failed, len(suites)) | ||
| if failed > 0 { | ||
| godogStatus = 1 | ||
| } | ||
| } | ||
|
|
||
| // Run any regular Go tests in this package too | ||
| testStatus := m.Run() | ||
| if testStatus > godogStatus { | ||
| godogStatus = testStatus | ||
| } | ||
|
|
||
| os.Exit(godogStatus) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.