Skip to content

Commit f0208f8

Browse files
authored
fix(server): correct query with tenant id for test run events (#3484)
1 parent 0652b3d commit f0208f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

server/testdb/test_run_event.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,17 @@ const getTestRunEventsQuery = `
101101
"data_store_connection",
102102
"polling",
103103
"outputs"
104-
FROM test_run_events WHERE "test_id" = $1 AND "run_id" = $2 ORDER BY "created_at" ASC;
104+
FROM test_run_events
105+
WHERE
106+
"test_id" = $1
107+
AND "run_id" = $2
108+
AND "tenant_id" = $3
109+
ORDER BY "created_at" ASC;
105110
`
106111

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

0 commit comments

Comments
 (0)