Merged in feature/localstackands3object (pull request #54)
LocalStack and S3 Objects * firstround * cleanupintegration * tidyports
This commit is contained in:
@@ -2,12 +2,11 @@ package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
documentinit "queryorchestration/internal/document/init"
|
||||
"queryorchestration/internal/server/runner"
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
"queryorchestration/internal/serviceconfig/queue"
|
||||
documentcleanc "queryorchestration/internal/serviceconfig/queue/documentclean"
|
||||
"queryorchestration/internal/test"
|
||||
queryservice "queryorchestration/pkg/queryService"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -49,6 +49,21 @@ func TestDocInitRunner(t *testing.T) {
|
||||
doccleanurl := test.CreateQueue(t, ctx, cfg, "docclean")
|
||||
bucketName := "docinitbucket"
|
||||
test.CreateBucket(t, ctx, cfg, bucketName)
|
||||
arn := fmt.Sprintf("arn:aws:sqs:%s:000000000000:%s", cfg.AWSRegion, test.DocInitRunner)
|
||||
_, err = cfg.StoreClient.PutBucketNotificationConfiguration(ctx, &s3.PutBucketNotificationConfigurationInput{
|
||||
Bucket: &bucketName,
|
||||
NotificationConfiguration: &types.NotificationConfiguration{
|
||||
QueueConfigurations: []types.QueueConfiguration{
|
||||
{
|
||||
QueueArn: &arn,
|
||||
Events: []types.Event{
|
||||
types.EventS3ObjectCreated,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
net, cleanup := test.CreateRunnersAndServicesNetwork(t, ctx, &test.EcosystemNetworkConfig{
|
||||
Cfg: cfg,
|
||||
@@ -91,7 +106,7 @@ func TestDocInitRunner(t *testing.T) {
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
location := "/i/am/here"
|
||||
location := fmt.Sprintf("%s/%s/%s", clientRes.JSON201.Id, jobRes.JSON201.Id, "object_name")
|
||||
body := strings.NewReader("hello world")
|
||||
_, err = cfg.StoreClient.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: &bucketName,
|
||||
@@ -100,15 +115,6 @@ func TestDocInitRunner(t *testing.T) {
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = cfg.SendToQueue(ctx, &queue.SendParams{
|
||||
QueueURL: net.Runners[test.DocInitRunner].URI,
|
||||
Body: documentinit.Create{
|
||||
JobID: jobRes.JSON201.Id,
|
||||
Location: location,
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
resRegex := regexp.MustCompile(`{"id": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"`)
|
||||
test.AssertMessageBody(t, ctx, cfg, doccleanurl, resRegex)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user