Skip to content
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

fix(server): fix tenant id query concatenation #3181

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion local-config/jaeger/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:

postgres:
image: postgres:14
image: postgres:15.2
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
Expand Down
4 changes: 2 additions & 2 deletions server/test/test_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (r *repository) GetAugmented(ctx context.Context, id id.ID) (Test, error) {
return r.get(ctx, id)
}

const sortQuery = `ORDER BY t.version DESC LIMIT 1`
const sortQuery = ` ORDER BY t.version DESC LIMIT 1`

func (r *repository) get(ctx context.Context, id id.ID) (Test, error) {
query, params := sqlutil.TenantWithPrefix(ctx, getTestSQL+" WHERE t.id = $1", "t.", id)
Expand All @@ -204,7 +204,7 @@ func (r *repository) get(ctx context.Context, id id.ID) (Test, error) {
}

func (r *repository) GetTestSuiteSteps(ctx context.Context, id id.ID, version int) ([]Test, error) {
sortQuery := `ORDER BY ts.step_number ASC`
sortQuery := ` ORDER BY ts.step_number ASC`
query, params := sqlutil.TenantWithPrefix(ctx, getTestSQL+testMaxVersionQuery+` INNER JOIN test_suite_steps ts ON t.id = ts.test_id
WHERE ts.test_suite_id = $1 AND ts.test_suite_version = $2`, "t.", id, version)
stmt, err := r.db.Prepare(query + sortQuery)
Expand Down
2 changes: 1 addition & 1 deletion server/testsuite/testsuite_run_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func (td *RunRepository) GetTestSuiteRun(ctx context.Context, ID id.ID, runID in
}

func (td *RunRepository) GetLatestRunByTestSuiteVersion(ctx context.Context, ID id.ID, version int) (TestSuiteRun, error) {
sortQuery := "ORDER BY created_at DESC LIMIT 1"
sortQuery := " ORDER BY created_at DESC LIMIT 1"
query, params := sqlutil.Tenant(ctx, selectTestSuiteRunQuery+" WHERE test_suite_id = $1 AND test_suite_version = $2", ID, version)
stmt, err := td.db.Prepare(query + sortQuery)
if err != nil {
Expand Down
Loading