bouncer/internal/datastore/testsuite/proxy_repository_cases.go

47 lines
880 B
Go

package testsuite
import (
"context"
"testing"
"forge.cadoles.com/cadoles/bouncer/internal/datastore"
"github.com/pkg/errors"
)
type proxyRepositoryTestCase struct {
Name string
Skip bool
Run func(ctx context.Context, repo datastore.ProxyRepository) error
}
var proxyRepositoryTestCases = []proxyRepositoryTestCase{
{
Name: "Create a new agent",
Run: func(ctx context.Context, repo datastore.ProxyRepository) error {
return nil
},
},
}
func runProxyRepositoryTests(t *testing.T, repo datastore.ProxyRepository) {
for _, tc := range proxyRepositoryTestCases {
func(tc proxyRepositoryTestCase) {
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
if tc.Skip {
t.SkipNow()
return
}
ctx := context.Background()
if err := tc.Run(ctx, repo); err != nil {
t.Errorf("%+v", errors.WithStack(err))
}
})
}(tc)
}
}