Unistore Chore: Add OTEL testing harness (#94835)

* add testing harness

* fix mockery and linters

* fix data race in tests

* fix data race in tests

* reduce cardinality of data
This commit is contained in:
Diego Augusto Molina
2024-10-17 08:41:06 -03:00
committed by GitHub
parent 8b9bb2acf6
commit cf08f6762d
14 changed files with 757 additions and 42 deletions
+26 -2
View File
@@ -28,6 +28,30 @@ func (d sqlDB) DriverName() string {
return d.driverName
}
func (d sqlDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (db.Tx, error) {
return d.DB.BeginTx(ctx, opts)
func (d sqlDB) QueryContext(ctx context.Context, query string, args ...any) (db.Rows, error) {
return d.DB.QueryContext(ctx, query, args...)
}
func (d sqlDB) QueryRowContext(ctx context.Context, query string, args ...any) db.Row {
return d.DB.QueryRowContext(ctx, query, args...)
}
func (d sqlDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (db.Tx, error) {
tx, err := d.DB.BeginTx(ctx, opts)
if err != nil {
return nil, err
}
return sqlTx{tx}, err
}
type sqlTx struct {
*sql.Tx
}
func (d sqlTx) QueryContext(ctx context.Context, query string, args ...any) (db.Rows, error) {
return d.Tx.QueryContext(ctx, query, args...)
}
func (d sqlTx) QueryRowContext(ctx context.Context, query string, args ...any) db.Row {
return d.Tx.QueryRowContext(ctx, query, args...)
}