chore: return a pointer to the generic suite

This commit is contained in:
Manuel de la Peña
2025-08-29 12:05:06 +02:00
parent 511351b66f
commit 2acb80b53a
2 changed files with 5 additions and 5 deletions

View File

@@ -76,9 +76,9 @@ type TCKSuite[T storage.Storage, D any, C testcontainers.Container] interface {
}
// New creates a new [StorageTestSuite] with the given [TCKSuite].
func New[T storage.Storage, D any, C testcontainers.Container](ctx context.Context, t *testing.T, tckSuite TCKSuite[T, D, C], opts ...suiteOption) (StorageTestSuite[T, D, C], error) {
func New[T storage.Storage, D any, C testcontainers.Container](ctx context.Context, t *testing.T, tckSuite TCKSuite[T, D, C], opts ...suiteOption) (*StorageTestSuite[T, D, C], error) {
if tckSuite == nil {
return StorageTestSuite[T, D, C]{}, fmt.Errorf("test suite is nil")
return nil, fmt.Errorf("test suite is nil")
}
s := StorageTestSuite[T, D, C]{
@@ -90,13 +90,13 @@ func New[T storage.Storage, D any, C testcontainers.Container](ctx context.Conte
for _, opt := range opts {
if err := opt.apply(&s); err != nil {
return StorageTestSuite[T, D, C]{}, fmt.Errorf("apply option: %w", err)
return nil, fmt.Errorf("apply option: %w", err)
}
}
s.SetT(t)
return s, nil
return &s, nil
}
// StorageTestSuite is the test suite for the storage.