2025-01-13 15:02:43 +00:00
|
|
|
package integration_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"queryorchestration/internal/test"
|
2025-01-15 19:45:51 +00:00
|
|
|
queryservice "queryorchestration/pkg/queryService"
|
2025-01-13 15:02:43 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestQueryServiceTest(t *testing.T) {
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
2025-02-03 17:30:50 +00:00
|
|
|
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
|
|
|
|
Name: test.QueryService,
|
|
|
|
|
})
|
2025-01-13 15:02:43 +00:00
|
|
|
defer cleanup()
|
|
|
|
|
|
2025-02-03 17:30:50 +00:00
|
|
|
client, err := queryservice.NewClientWithResponses(c.URI)
|
|
|
|
|
assert.NoError(t, err)
|
2025-01-13 15:02:43 +00:00
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
idRes, err := client.CreateQueryWithResponse(ctx, queryservice.QueryCreate{
|
|
|
|
|
Type: queryservice.CONTEXTFULL,
|
2025-01-13 15:02:43 +00:00
|
|
|
})
|
2025-02-03 17:30:50 +00:00
|
|
|
assert.NoError(t, err)
|
2025-01-15 19:45:51 +00:00
|
|
|
id := idRes.JSON201.Id
|
2025-01-13 15:02:43 +00:00
|
|
|
assert.NotEmpty(t, id)
|
|
|
|
|
|
|
|
|
|
docId := uuid.New()
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
testRes, err := client.TestQueryWithResponse(ctx, id, queryservice.QueryTestRequest{
|
2025-01-24 14:52:56 +00:00
|
|
|
DocumentId: docId,
|
2025-01-13 15:02:43 +00:00
|
|
|
QueryVersion: int32(1),
|
|
|
|
|
})
|
2025-02-03 17:30:50 +00:00
|
|
|
assert.NoError(t, err)
|
2025-01-13 15:02:43 +00:00
|
|
|
assert.NotNil(t, testRes)
|
2025-01-29 16:26:11 +00:00
|
|
|
// TODO
|
2025-01-29 11:52:37 +00:00
|
|
|
// assert.NotNil(t, testRes.JSON200)
|
|
|
|
|
// assert.Equal(t, "hey", testRes.JSON200.Value)
|
2025-01-13 15:02:43 +00:00
|
|
|
}
|