40 lines
931 B
Go
40 lines
931 B
Go
|
|
package integration_test
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||
|
|
"queryorchestration/internal/test"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestQueryServiceTest(t *testing.T) {
|
||
|
|
ctx := context.Background()
|
||
|
|
|
||
|
|
conn, cleanup := test.CreateAPIWithDependencies(t, ctx, "queryService")
|
||
|
|
defer cleanup()
|
||
|
|
|
||
|
|
client := serviceinterfaces.NewQueryServiceClient(conn)
|
||
|
|
|
||
|
|
idRes, err := client.Create(ctx, &serviceinterfaces.QueryCreate{
|
||
|
|
Type: serviceinterfaces.QueryType_QUERY_TYPE_CONTEXT_FULL,
|
||
|
|
Config: nil,
|
||
|
|
RequiredQueries: []string{},
|
||
|
|
})
|
||
|
|
assert.Nil(t, err)
|
||
|
|
id := idRes.GetId()
|
||
|
|
assert.NotEmpty(t, id)
|
||
|
|
|
||
|
|
docId := uuid.New()
|
||
|
|
|
||
|
|
testRes, err := client.Test(ctx, &serviceinterfaces.QueryTestRequest{
|
||
|
|
QueryId: id,
|
||
|
|
DocumentId: docId.String(),
|
||
|
|
QueryVersion: int32(1),
|
||
|
|
})
|
||
|
|
assert.Nil(t, err)
|
||
|
|
assert.NotNil(t, testRes)
|
||
|
|
}
|