Skip to content

Commit

Permalink
feat(server): minimize run list response size (#3612)
Browse files Browse the repository at this point in the history
  • Loading branch information
schoren committed Feb 8, 2024
1 parent 240b4e5 commit 810b698
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/http/controller.go
Expand Up @@ -251,7 +251,7 @@ func (c *controller) GetTestRuns(ctx context.Context, testID string, take, skip
}

return openapi.Response(200, paginated[openapi.TestRun]{
items: c.mappers.Out.Runs(runs),
items: c.mappers.Out.RunsSimplified(runs),
count: count,
}), nil
}
Expand Down
11 changes: 11 additions & 0 deletions server/http/mappings/tests.go
Expand Up @@ -338,6 +338,17 @@ func (m OpenAPI) Runs(in []test.Run) []openapi.TestRun {
return runs
}

func (m OpenAPI) RunsSimplified(in []test.Run) []openapi.TestRun {
runs := make([]openapi.TestRun, len(in))
for i, t := range in {
// remove non requried fields
t.Trace = nil
runs[i] = m.Run(&t)
}

return runs
}

// in
type Model struct {
comparators comparator.Registry
Expand Down

0 comments on commit 810b698

Please sign in to comment.