Skip to content

Commit

Permalink
fix(server): correct query with tenant id for test run events (#3484)
Browse files Browse the repository at this point in the history
  • Loading branch information
schoren authored Dec 28, 2023
1 parent 0652b3d commit f0208f8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions server/testdb/test_run_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,17 @@ const getTestRunEventsQuery = `
"data_store_connection",
"polling",
"outputs"
FROM test_run_events WHERE "test_id" = $1 AND "run_id" = $2 ORDER BY "created_at" ASC;
FROM test_run_events
WHERE
"test_id" = $1
AND "run_id" = $2
AND "tenant_id" = $3
ORDER BY "created_at" ASC;
`

func (td *postgresDB) GetTestRunEvents(ctx context.Context, testID id.ID, runID int) ([]model.TestRunEvent, error) {
query, params := sqlutil.Tenant(ctx, getTestRunEventsQuery, testID, runID)
rows, err := td.db.QueryContext(ctx, query, params...)
params := sqlutil.TenantInsert(ctx, testID, runID)
rows, err := td.db.QueryContext(ctx, getTestRunEventsQuery, params...)
if err != nil {
return []model.TestRunEvent{}, fmt.Errorf("could not query test runs: %w", err)
}
Expand Down

0 comments on commit f0208f8

Please sign in to comment.