Merged in feature/testwithlogs (pull request #65)

Query Version Sync Runner

* testing

* queryversiosyncworking

* update

* tests

* fixtests
This commit is contained in:
Michael McGuinness
2025-02-14 10:56:24 +00:00
parent 477518e5eb
commit 0df3d16976
91 changed files with 1737 additions and 624 deletions
+10 -1
View File
@@ -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,
},
},
},
+2 -1
View File
@@ -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()
+2 -1
View File
@@ -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()
+2 -1
View File
@@ -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()
+2 -1
View File
@@ -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()
+34 -2
View File
@@ -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)