docs: document the TCK

This commit is contained in:
Manuel de la Peña
2025-08-29 12:32:42 +02:00
parent aba91259ed
commit ecc8188b78
3 changed files with 322 additions and 0 deletions

View File

@@ -24,8 +24,12 @@ const (
mysqlDatabase string = "fiber"
)
// MySQLStorageTCK is the test suite for the MySQL storage.
type MySQLStorageTCK struct{}
// NewStore is a function that returns a new MySQL storage.
// It implements the [tck.TCKSuite] interface, allowing the TCK to create a new MySQL storage
// from the container created by the TCK.
func (s *MySQLStorageTCK) NewStore() func(ctx context.Context, tb testing.TB, ctr *mysql.MySQLContainer) (*Storage, error) {
return func(ctx context.Context, tb testing.TB, ctr *mysql.MySQLContainer) (*Storage, error) {
conn, err := ctr.ConnectionString(ctx)
@@ -40,6 +44,9 @@ func (s *MySQLStorageTCK) NewStore() func(ctx context.Context, tb testing.TB, ct
}
}
// NewContainer is a function that returns a new MySQL container.
// It implements the [tck.TCKSuite] interface, allowing the TCK to create a new MySQL container
// for the MySQL storage.
func (s *MySQLStorageTCK) NewContainer() func(ctx context.Context, tb testing.TB) (*mysql.MySQLContainer, error) {
return func(ctx context.Context, tb testing.TB) (*mysql.MySQLContainer, error) {
return mustStartMySQL(tb), nil