Add selector split-unit support to Test Engine Client#558
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019efc16-634d-7329-b5c5-3661eec35315 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019efc16-634d-7329-b5c5-3661eec35315 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019efc16-634d-7329-b5c5-3661eec35315 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019efc16-634d-7329-b5c5-3661eec35315 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019efc16-634d-7329-b5c5-3661eec35315 Co-authored-by: Amp <amp@ampcode.com>
| Path string `json:"path"` | ||
| Scope string `json:"scope,omitempty"` | ||
| // Value is the runnable selector for selector-based plans, for example a Go package import path. | ||
| Value string `json:"value,omitempty"` |
There was a problem hiding this comment.
Should we call this Selector?
| Value string `json:"value,omitempty"` | |
| Selector string `json:"selector,omitempty"` |
There was a problem hiding this comment.
The current API shape uses { "value": "github.com/..." } so I don't think we can do a full rename here but we could do:
Selector string `json:"value,omitempty"`
There was a problem hiding this comment.
I’m leaning towards keeping this as value, since format: "selector" already identifies it as a selector.
There was a problem hiding this comment.
Ok for now. I think the problem is because we use the same type for input (API request params), output (API response), and bktec internalsw, so it is a bit confusing at the moment. Maybe we should separate them at some point. We have this top level comment for that type.
// TestCase currently can represent a single test case or a single test file (when used as output of test plan API).
// TODO: it's best if we split this into two types.
| // Currently only the Pytest runner supports tag filtering. | ||
| func createRequestParam(ctx context.Context, cfg *config.Config, files []string, client api.Client, runner runner.TestRunner) (api.TestPlanParams, error) { | ||
| if shouldUseSelectorSplitting(cfg, runner) { | ||
| selectors := make([]api.TestPlanParamsSelector, 0, len(files)) |
There was a problem hiding this comment.
Its an existing poor design of bktec, but currently we pass files to this function. However for go test, we are actually passing "packages". Maybe we should rename files to something like filesOrSelectors (Can't think of better name :D), or put a comment? Ideally we will pass selectors and the runner responsible and creating the selectors.
There was a problem hiding this comment.
Updated this to be testTargets, not sure if that is any better 🤷🏼♀️
|
@buildsworth-bk review |
nprizal
left a comment
There was a problem hiding this comment.
Looks good to me. Will test this e2e next week before merging.
| command: ".buildkite/steps/tests.sh" | ||
| parallelism: 2 | ||
| env: | ||
| BUILDKITE_TEST_ENGINE_SELECTOR_SPLITTING: "true" |
There was a problem hiding this comment.
@nprizal I added this flag so this can just be merged and tested! You can see it working on this branch
It still says "no history" as we need to also turn on the TestEngineUseSelectorPrimaryTimingsForTestPlan feature flag for bk for it to hit the new selector-tag timing query

Description
Adds experimental selector-based split-unit support to bktec so supported non-file runners can request and execute selector plans from Test Engine. This is gated behind
--selector-splitting/BUILDKITE_TEST_ENGINE_SELECTOR_SPLITTING=true, keeping existing file/example splitting behaviour unchanged by default.Context
Linear: https://linear.app/buildkite/issue/TE-6156/add-selector-split-unit-support-to-test-engine-client
Related API/planner shape: https://linear.app/buildkite/issue/TE-6157/add-selector-split-units-to-the-test-plan-api-and-planner-model
Changes
go testas selector-capable.go testexecution and split summaries.Testing
go test ./...— fails locally because integration-style runner tests require external binaries that are not installed in this environment (rspec,pytest,cucumber,yarn,gotestsum).