2025-01-07 13:01:14 +00:00
|
|
|
package integration_test
|
2024-12-23 12:56:47 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"encoding/json"
|
2024-12-24 17:13:48 +00:00
|
|
|
"queryorchestration/internal/document"
|
2025-01-10 19:17:20 +00:00
|
|
|
"queryorchestration/internal/queue"
|
|
|
|
|
"queryorchestration/internal/test"
|
2024-12-23 12:56:47 +00:00
|
|
|
"testing"
|
|
|
|
|
|
2025-01-10 19:17:20 +00:00
|
|
|
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
|
2024-12-23 12:56:47 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2025-01-07 16:12:18 +00:00
|
|
|
func TestQueryRunner(t *testing.T) {
|
2024-12-23 12:56:47 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
|
2025-01-10 19:17:20 +00:00
|
|
|
qCfg, cleanup := test.CreateQueueWithDependencies(t, ctx, "queryRunner")
|
2024-12-23 12:56:47 +00:00
|
|
|
defer cleanup()
|
|
|
|
|
|
|
|
|
|
document := document.Document{
|
|
|
|
|
ID: uuid.New(),
|
|
|
|
|
JobID: uuid.New(),
|
2025-01-06 13:30:20 +00:00
|
|
|
Name: "documentname",
|
2024-12-23 12:56:47 +00:00
|
|
|
CleanVersion: int32(1),
|
|
|
|
|
TextVersion: int32(1),
|
|
|
|
|
}
|
|
|
|
|
docJson, err := json.Marshal(document)
|
|
|
|
|
assert.Nil(t, err)
|
|
|
|
|
|
2025-01-10 19:17:20 +00:00
|
|
|
cfg := &queue.Config{
|
|
|
|
|
URL: qCfg.URL,
|
|
|
|
|
Client: qCfg.Client,
|
|
|
|
|
}
|
2024-12-23 12:56:47 +00:00
|
|
|
|
2025-01-13 17:31:30 +00:00
|
|
|
err = queue.Send(ctx, cfg, string(docJson), map[string]types.MessageAttributeValue{})
|
|
|
|
|
assert.Nil(t, err)
|
2024-12-23 12:56:47 +00:00
|
|
|
}
|