Skip to content

Commit

Permalink
fix : debugs
Browse files Browse the repository at this point in the history
Signed-off-by: RazenaSaleem <[email protected]>
  • Loading branch information
RazenaSaleem committed Jun 8, 2024
1 parent 3689db7 commit 6efc937
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions server/test/run_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (r *runRepository) GetRun(ctx context.Context, testID id.ID, runID int) (Ru

run, err := readRunRow(r.db.QueryRowContext(ctx, query, params...))
if err != nil {
return Run{}, fmt.Errorf("cannot read row: %w", err)
return Run{}, fmt.Errorf("run repo 1 - cannot read row: %w", err)
}
return run, nil
}
Expand Down Expand Up @@ -424,7 +424,7 @@ func (r *runRepository) GetRunByTraceID(ctx context.Context, traceID trace.Trace

run, err := readRunRow(stmt.QueryRowContext(ctx, params...))
if err != nil {
return Run{}, fmt.Errorf("cannot read row: %w", err)
return Run{}, fmt.Errorf("run repo 2 -cannot read row: %w", err)
}
return run, nil
}
Expand All @@ -451,7 +451,7 @@ func (r *runRepository) readRunRows(ctx context.Context, rows *sql.Rows) ([]Run,
for rows.Next() {
run, err := readRunRow(rows)
if err != nil {
return []Run{}, fmt.Errorf("cannot read row: %w", err)
return []Run{}, fmt.Errorf("run repo 3 -cannot read row: %w", err)
}
runs = append(runs, run)
}
Expand Down
4 changes: 3 additions & 1 deletion server/test/test_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (r *repository) ListAugmented(ctx context.Context, take, skip int, query, s
}

func (r *repository) list(ctx context.Context, take, skip int, query, sortBy, sortDirection string) ([]Test, error) {
fmt.Println("query1")
sql := getTestSQL + testMaxVersionQuery
params := []any{take, skip}
paramNumber := len(params) + 1
Expand Down Expand Up @@ -193,6 +194,7 @@ func (r *repository) GetAugmented(ctx context.Context, id id.ID) (Test, error) {
const sortQuery = `ORDER BY t.version DESC LIMIT 1`

func (r *repository) get(ctx context.Context, id id.ID) (Test, error) {
fmt.Println("query2")
query, params := sqlutil.TenantWithPrefix(ctx, getTestSQL+" WHERE t.id = $1", "t.", id)

test, err := r.readRow(ctx, r.db.QueryRowContext(ctx, query+sortQuery, params...))
Expand Down Expand Up @@ -284,7 +286,7 @@ func (r *repository) readRow(ctx context.Context, row scanner) (Test, error) {
return Test{}, err
}

return Test{}, fmt.Errorf("cannot read row: %w", err)
return Test{}, fmt.Errorf("test repo - cannot read row: %w", err)
}

err = json.Unmarshal(jsonServiceUnderTest, &test.Trigger)
Expand Down
6 changes: 3 additions & 3 deletions server/testsuite/testsuite_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func (r *Repository) readRows(ctx context.Context, rows *sql.Rows, augmented boo
for rows.Next() {
transaction, err := r.readRow(ctx, rows, augmented)
if err != nil {
return []TestSuite{}, fmt.Errorf("cannot read rows: %w", err)
return []TestSuite{}, fmt.Errorf("testsuite repo 1 cannot read rows: %w", err)
}

transactions = append(transactions, transaction)
Expand Down Expand Up @@ -465,7 +465,7 @@ func (r *Repository) readRow(ctx context.Context, row scanner, augmented bool) (
return suite, err
}

return TestSuite{}, fmt.Errorf("cannot read row: %w", err)
return TestSuite{}, fmt.Errorf("testsuite repo 2 cannot read row: %w", err)
}

if stepIDs != nil && *stepIDs != "" {
Expand Down Expand Up @@ -495,7 +495,7 @@ func (r *Repository) readRow(ctx context.Context, row scanner, augmented bool) (
} else {
steps, err := r.stepRepository.GetTestSuiteSteps(ctx, suite.ID, *suite.Version)
if err != nil {
return TestSuite{}, fmt.Errorf("cannot read row: %w", err)
return TestSuite{}, fmt.Errorf("testsuite repo 3 cannot read row: %w", err)
}

suite.Steps = steps
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 @@ -424,7 +424,7 @@ func (td *RunRepository) readRunRow(row scanner) (TestSuiteRun, error) {
&jsonVariableSet,
)
if err != nil {
return TestSuiteRun{}, fmt.Errorf("cannot read row: %w", err)
return TestSuiteRun{}, fmt.Errorf("testsuite run repo - cannot read row: %w", err)
}

err = json.Unmarshal(jsonMetadata, &r.Metadata)
Expand Down

0 comments on commit 6efc937

Please sign in to comment.