Merged in feature/testwithlogs (pull request #65)
Query Version Sync Runner * testing * queryversiosyncworking * update * tests * fixtests
This commit is contained in:
+10
-1
@@ -52,6 +52,7 @@ func TestProcess(t *testing.T) {
|
||||
querysyncurl := test.CreateQueue(t, ctx, cfg, test.QuerySyncRunner)
|
||||
queryurl := test.CreateQueue(t, ctx, cfg, test.QueryRunner)
|
||||
jobsyncurl := test.CreateQueue(t, ctx, cfg, test.JobSyncRunner)
|
||||
queryversionsyncurl := test.CreateQueue(t, ctx, cfg, test.QueryVersionSyncRunner)
|
||||
|
||||
bucketName := "docinitbucket"
|
||||
test.CreateBucket(t, ctx, cfg, bucketName)
|
||||
@@ -125,12 +126,20 @@ func TestProcess(t *testing.T) {
|
||||
"DOCUMENT_SYNC_URL": docsyncurl,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: test.QueryVersionSyncRunner,
|
||||
QueueURL: &queryversionsyncurl,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": jobsyncurl,
|
||||
},
|
||||
},
|
||||
},
|
||||
Services: []*test.ServiceNetworkConfig{
|
||||
{
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": jobsyncurl,
|
||||
"JOB_SYNC_URL": jobsyncurl,
|
||||
"QUERY_VERSION_SYNC_URL": queryversionsyncurl,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -15,7 +15,8 @@ func TestClient(t *testing.T) {
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"QUERY_VERSION_SYNC_URL": "iamthere",
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
@@ -15,7 +15,8 @@ func TestExportService(t *testing.T) {
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"QUERY_VERSION_SYNC_URL": "iamthere",
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
@@ -15,7 +15,8 @@ func TestJob(t *testing.T) {
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"QUERY_VERSION_SYNC_URL": "iamthere",
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
@@ -46,7 +46,8 @@ func TestJobCollectorService(t *testing.T) {
|
||||
Network: network,
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": jobsyncurl,
|
||||
"JOB_SYNC_URL": jobsyncurl,
|
||||
"QUERY_VERSION_SYNC_URL": "iamthere",
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
@@ -16,7 +16,8 @@ func TestQueryServiceOpenAPI(t *testing.T) {
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"QUERY_VERSION_SYNC_URL": "iamthere",
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
@@ -2,21 +2,51 @@ package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/queue"
|
||||
"queryorchestration/internal/test"
|
||||
queryservice "queryorchestration/pkg/queryService"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/oapi-codegen/runtime/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type QueryConfig struct {
|
||||
serviceconfig.BaseConfig
|
||||
queue.QueueConfig
|
||||
}
|
||||
|
||||
func TestQueryService(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &QueryConfig{}
|
||||
test.SetCfgProvider(t, cfg)
|
||||
cfg.SetBasePath(path.Join(os.Getenv("PWD"), "../.."))
|
||||
|
||||
network, ncleanup := test.CreateNetwork(t, ctx)
|
||||
defer ncleanup()
|
||||
|
||||
_, clean := test.CreateAWSContainer(t, ctx, &test.CreateAWSConfig{
|
||||
Cfg: cfg,
|
||||
Network: network,
|
||||
})
|
||||
defer clean()
|
||||
|
||||
err := cfg.SetQueueClient(ctx)
|
||||
assert.NoError(t, err)
|
||||
queryversionsyncurl := test.CreateQueue(t, ctx, cfg, test.QueryVersionSyncRunner)
|
||||
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
Name: test.QueryService,
|
||||
Cfg: cfg,
|
||||
Network: network,
|
||||
Name: test.QueryService,
|
||||
Env: map[string]string{
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"JOB_SYNC_URL": "/i/am/here",
|
||||
"QUERY_VERSION_SYNC_URL": queryversionsyncurl,
|
||||
},
|
||||
})
|
||||
defer cleanup()
|
||||
@@ -64,6 +94,8 @@ func TestQueryService(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, res)
|
||||
|
||||
test.AssertMessageBody(t, ctx, cfg, queryversionsyncurl, regexp.MustCompile(`{"id":".+"}`))
|
||||
|
||||
queryRes, err = client.GetQueryWithResponse(ctx, jsonID)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, jsonID, queryRes.JSON200.Id)
|
||||
|
||||
Reference in New Issue
Block a user