Merged in feature/testclean (pull request #126)
Bit of test clean up * fixes
This commit is contained in:
@@ -8,100 +8,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/aws"
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCreateAPINetwork(t *testing.T) {
|
||||
t.Parallel()
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping long test in short mode")
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &FullDepsConfig{}
|
||||
|
||||
conn, cleanup := CreateAPINetwork(t, ctx, cfg, QueryAPI)
|
||||
|
||||
assert.NotNil(t, conn)
|
||||
assert.NotNil(t, cleanup)
|
||||
|
||||
cleanup()
|
||||
}
|
||||
|
||||
type FullDepsConfig struct {
|
||||
aws.AWSConfig
|
||||
serviceconfig.BaseConfig
|
||||
objectstore.ObjectStoreConfig
|
||||
}
|
||||
|
||||
func TestCreateFullDependencies(t *testing.T) {
|
||||
t.Parallel()
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping long test in short mode")
|
||||
}
|
||||
ctx := context.Background()
|
||||
cfg := &FullDepsConfig{}
|
||||
|
||||
conn, cleanup := CreateFullDependencies(t, ctx, cfg)
|
||||
|
||||
assert.NotNil(t, conn)
|
||||
assert.NotNil(t, cleanup)
|
||||
|
||||
cleanup()
|
||||
}
|
||||
|
||||
func TestCreateFullNetwork(t *testing.T) {
|
||||
t.Parallel()
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping long test in short mode")
|
||||
}
|
||||
ctx := context.Background()
|
||||
cfg := &FullDepsConfig{}
|
||||
|
||||
conn, cleanup := CreateFullNetwork(t, ctx, cfg)
|
||||
|
||||
assert.NotNil(t, conn)
|
||||
assert.NotNil(t, cleanup)
|
||||
|
||||
cleanup()
|
||||
}
|
||||
|
||||
func TestCreateMockServer(t *testing.T) {
|
||||
t.Parallel()
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping long test in short mode")
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
net := DepNetwork.Get(t, ctx)
|
||||
|
||||
server, cleanup := CreateMockServer(t, ctx, net)
|
||||
|
||||
assert.NotNil(t, server)
|
||||
assert.NotNil(t, cleanup)
|
||||
|
||||
cleanup()
|
||||
}
|
||||
|
||||
func TestCreateMockExpectation(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
defer ts.Close()
|
||||
|
||||
server := MockServer{
|
||||
Client: ts.Client(),
|
||||
External: Address(ts.URL),
|
||||
}
|
||||
expectation := MockExpectation{}
|
||||
CreateMockExpectation(t, server, expectation)
|
||||
}
|
||||
|
||||
func TestCreateDetectDocumentTextExpectation(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
Reference in New Issue
Block a user