-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add suite_status filter for cloud drift tests #210
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ func ConvertTraceTestToRunnerTest(tt *backend.TraceTest) Test { | |
| DisplayType: "HTTP", // will be overridden if we detect GraphQL/etc. | ||
| DisplayName: fmt.Sprintf("Trace %s", tt.TraceId), | ||
| Status: "pending", | ||
| SuiteStatus: protoTraceTestStatusToString(tt.GetStatus()), | ||
| } | ||
|
|
||
| // Extract environment from any span that has it | ||
|
|
@@ -287,6 +288,34 @@ func ConvertRunnerResultToTraceTestResult(result TestResult, test Test) *backend | |
| return out | ||
| } | ||
|
|
||
| func protoTraceTestStatusToString(s backend.TraceTestStatus) string { | ||
| switch s { | ||
| case backend.TraceTestStatus_TRACE_TEST_STATUS_DRAFT: | ||
| return "draft" | ||
| case backend.TraceTestStatus_TRACE_TEST_STATUS_IN_SUITE: | ||
| return "in_suite" | ||
| case backend.TraceTestStatus_TRACE_TEST_STATUS_REMOVED: | ||
| return "removed" | ||
| default: | ||
| return "" | ||
| } | ||
| } | ||
|
|
||
| // ParseTraceTestStatusFilter converts a user-provided filter value to a proto TraceTestStatus. | ||
| // Returns nil if the value doesn't match a known status. | ||
| func ParseTraceTestStatusFilter(val string) *backend.TraceTestStatus { | ||
| switch strings.ToLower(val) { | ||
| case "draft": | ||
| s := backend.TraceTestStatus_TRACE_TEST_STATUS_DRAFT | ||
| return &s | ||
| case "in_suite": | ||
| s := backend.TraceTestStatus_TRACE_TEST_STATUS_IN_SUITE | ||
| return &s | ||
| default: | ||
| return nil | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Case-insensitive server filter vs case-sensitive client regexMedium Severity
Additional Locations (2) |
||
|
|
||
| func getStringFromStruct(s *structpb.Struct, key string) (string, bool) { | ||
| if s == nil || s.Fields == nil { | ||
| return "", false | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,8 @@ func normalizeFilterFieldKey(k string) string { | |
| return "id" | ||
| case "file", "filename", "f": | ||
| return "file" | ||
| case "suite_status", "suite": | ||
| return "suite_status" | ||
| default: | ||
| return "" | ||
| } | ||
|
|
@@ -155,6 +157,8 @@ func getFieldValueForFilter(t Test, field string) string { | |
| return t.TraceID | ||
| case "file": | ||
| return t.FileName | ||
| case "suite_status": | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Either normalize the Prompt for AI agents |
||
| return t.SuiteStatus | ||
| default: | ||
| return "" | ||
| } | ||
|
|
@@ -172,6 +176,21 @@ func extractGraphQLOperationName(displayName string) string { | |
| return displayName | ||
| } | ||
|
|
||
| // ExtractSuiteStatusFromFilter extracts the suite_status value from a filter string. | ||
| // Returns the value and true if found, empty string and false otherwise. | ||
| func ExtractSuiteStatusFromFilter(filter string) (string, bool) { | ||
| matchers, err := parseFieldedFilter(filter) | ||
| if err != nil { | ||
| return "", false | ||
| } | ||
| for _, m := range matchers { | ||
| if m.field == "suite_status" { | ||
| return m.re.String(), true | ||
| } | ||
| } | ||
| return "", false | ||
| } | ||
|
|
||
| // FilterLocalTestsForExecution filters out local tests with HTTP status >= 300. | ||
| // These tests are skipped for replay but their spans remain available for mock matching. | ||
| // Returns (testsToExecute, excludedCount). | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2:
suite_statusregex values silently fall back to the cache path, which only returns IN_SUITE tests, so valid filter forms (for examplesuite_status=^draft$) can miss draft tests.Prompt for AI agents