Merged in bugfix/fixe2etests (pull request #64)

Fix e2e test

* fix
This commit is contained in:
Michael McGuinness
2025-02-13 00:23:13 +00:00
parent c1e9d93037
commit f5bd522faf
12 changed files with 82 additions and 84 deletions
+27 -17
View File
@@ -26,7 +26,6 @@ type ProcessConfig struct {
}
func TestProcess(t *testing.T) {
t.SkipNow()
ctx := context.Background()
cfg := &ProcessConfig{}
@@ -46,6 +45,14 @@ func TestProcess(t *testing.T) {
assert.NoError(t, err)
test.CreateStoreClient(t, ctx, cfg, acfg.ExternalEndpoint)
dociniturl := test.CreateQueue(t, ctx, cfg, test.DocInitRunner)
docsyncurl := test.CreateQueue(t, ctx, cfg, test.DocSyncRunner)
doccleanurl := test.CreateQueue(t, ctx, cfg, test.DocCleanRunner)
doctexturl := test.CreateQueue(t, ctx, cfg, test.DocTextRunner)
querysyncurl := test.CreateQueue(t, ctx, cfg, test.QuerySyncRunner)
queryurl := test.CreateQueue(t, ctx, cfg, test.QueryRunner)
jobsyncurl := test.CreateQueue(t, ctx, cfg, test.JobSyncRunner)
bucketName := "docinitbucket"
test.CreateBucket(t, ctx, cfg, bucketName)
arn := fmt.Sprintf("arn:aws:sqs:%s:000000000000:%s", cfg.AWSRegion, test.DocInitRunner)
@@ -64,55 +71,56 @@ func TestProcess(t *testing.T) {
})
assert.NoError(t, err)
docsyncurl := test.CreateQueue(t, ctx, cfg, test.DocSyncRunner)
doccleanurl := test.CreateQueue(t, ctx, cfg, test.DocCleanRunner)
doctexturl := test.CreateQueue(t, ctx, cfg, test.DocTextRunner)
querysyncurl := test.CreateQueue(t, ctx, cfg, test.QuerySyncRunner)
queryurl := test.CreateQueue(t, ctx, cfg, test.QueryRunner)
jobsyncurl := test.CreateQueue(t, ctx, cfg, test.JobSyncRunner)
net, cleanup := test.CreateRunnersAndServicesNetwork(t, ctx, &test.EcosystemNetworkConfig{
Cfg: cfg,
Network: network,
Cfg: cfg,
Network: network,
AWSContainer: acfg,
Runners: []*test.RunnerNetworkConfig{
{
Name: test.DocInitRunner,
Name: test.DocInitRunner,
QueueURL: &dociniturl,
Env: map[string]string{
"DOCUMENT_SYNC_URL": docsyncurl,
},
},
{
Name: test.DocSyncRunner,
Name: test.DocSyncRunner,
QueueURL: &docsyncurl,
Env: map[string]string{
"DOCUMENT_CLEAN_URL": doccleanurl,
},
},
{
Name: test.DocCleanRunner,
Name: test.DocCleanRunner,
QueueURL: &doccleanurl,
Env: map[string]string{
"DOCUMENT_TEXT_URL": doctexturl,
},
},
{
Name: test.DocTextRunner,
Name: test.DocTextRunner,
QueueURL: &doctexturl,
Env: map[string]string{
"QUERY_SYNC_URL": querysyncurl,
},
},
{
Name: test.QuerySyncRunner,
Name: test.QuerySyncRunner,
QueueURL: &querysyncurl,
Env: map[string]string{
"QUERY_URL": queryurl,
},
},
{
Name: test.QueryRunner,
Name: test.QueryRunner,
QueueURL: &queryurl,
Env: map[string]string{
"QUERY_URL": queryurl,
},
},
{
Name: test.JobSyncRunner,
Name: test.JobSyncRunner,
QueueURL: &jobsyncurl,
Env: map[string]string{
"DOCUMENT_SYNC_URL": docsyncurl,
},
@@ -155,8 +163,10 @@ func TestProcess(t *testing.T) {
Type: queryservice.CONTEXTFULL,
})
assert.NoError(t, err)
jcfg := `{"path":"id"}`
jsonQueryRes, err := qService.CreateQueryWithResponse(ctx, queryservice.QueryCreate{
Type: queryservice.JSONEXTRACTOR,
Config: &jcfg,
RequiredQueries: &[]types.UUID{contextQueryRes.JSON201.Id},
})
assert.NoError(t, err)
-45
View File
@@ -1,45 +0,0 @@
package endtoend_test
import (
"context"
"queryorchestration/internal/test"
queryservice "queryorchestration/pkg/queryService"
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)
func TestQueryServiceTest(t *testing.T) {
ctx := context.Background()
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
Name: test.QueryService,
Env: map[string]string{
"JOB_SYNC_URL": "/i/am/here",
},
})
defer cleanup()
client, err := queryservice.NewClientWithResponses(c.URI)
assert.NoError(t, err)
idRes, err := client.CreateQueryWithResponse(ctx, queryservice.QueryCreate{
Type: queryservice.CONTEXTFULL,
})
assert.NoError(t, err)
id := idRes.JSON201.Id
assert.NotEmpty(t, id)
docId := uuid.New()
testRes, err := client.TestQueryWithResponse(ctx, id, queryservice.QueryTestRequest{
DocumentId: docId,
QueryVersion: int32(1),
})
assert.NoError(t, err)
assert.NotNil(t, testRes)
// TODO
// assert.NotNil(t, testRes.JSON200)
// assert.Equal(t, "hey", testRes.JSON200.Value)
}