feat: initial commit
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
This commit is contained in:
14
internal/datastore/testsuite/proxy_repository.go
Normal file
14
internal/datastore/testsuite/proxy_repository.go
Normal file
@ -0,0 +1,14 @@
|
||||
package testsuite
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/datastore"
|
||||
)
|
||||
|
||||
func TestProxyRepository(t *testing.T, repo datastore.ProxyRepository) {
|
||||
t.Run("Cases", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
runProxyRepositoryTests(t, repo)
|
||||
})
|
||||
}
|
46
internal/datastore/testsuite/proxy_repository_cases.go
Normal file
46
internal/datastore/testsuite/proxy_repository_cases.go
Normal file
@ -0,0 +1,46 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user