5ca36b0502
Feature/listtypes * started * cleanuplist * someunittestfixes * removemostflakiness
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package integration_test
|
|
|
|
import (
|
|
"context"
|
|
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
|
"queryorchestration/internal/test"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestQueryServiceList(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
conn, cleanup := test.CreateAPIWithDependencies(t, ctx, "queryService")
|
|
defer cleanup()
|
|
|
|
client := serviceinterfaces.NewQueryServiceClient(conn)
|
|
|
|
contextRes, err := client.Create(ctx, &serviceinterfaces.QueryCreate{
|
|
Type: serviceinterfaces.QueryType_QUERY_TYPE_CONTEXT_FULL,
|
|
Config: nil,
|
|
RequiredQueries: []string{},
|
|
})
|
|
assert.Nil(t, err)
|
|
|
|
config := "\"path\":\".key\""
|
|
_, err = client.Create(ctx, &serviceinterfaces.QueryCreate{
|
|
Type: serviceinterfaces.QueryType_QUERY_TYPE_JSON_EXTRACTOR,
|
|
Config: &config,
|
|
RequiredQueries: []string{
|
|
contextRes.Id,
|
|
},
|
|
})
|
|
assert.Nil(t, err)
|
|
|
|
queriesRes, err := client.List(ctx, &serviceinterfaces.QueryFilter{})
|
|
assert.Nil(t, err)
|
|
assert.Len(t, queriesRes.Queries, 2)
|
|
}
|