Merged in feature/jobcollector (pull request #30)
Initial Job Collector (changes pending) * movearroundtocleancollector * internalgetfunctions * completecollectorquery * simplify * fixtests * addvendor * noplaceholder
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
controllers "queryorchestration/api/queryRunner"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/job/collector"
|
||||
"queryorchestration/internal/query/document"
|
||||
"testing"
|
||||
|
||||
@@ -18,9 +19,6 @@ import (
|
||||
)
|
||||
|
||||
func TestQueryRunner(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping long test in short mode")
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
@@ -33,7 +31,9 @@ func TestQueryRunner(t *testing.T) {
|
||||
Pool: pool,
|
||||
}
|
||||
|
||||
svc := document.New(db)
|
||||
svc := document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
})
|
||||
|
||||
runner := controllers.NewQueryRunner(svc, validator.New())
|
||||
assert.NotNil(t, runner)
|
||||
@@ -58,20 +58,20 @@ func TestQueryRunner(t *testing.T) {
|
||||
|
||||
qV := int32(1)
|
||||
|
||||
pool.ExpectQuery("name: GetCollectorFromJobID :one").WithArgs(database.MustToDBUUID(doc.JobID)).
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(database.MustToDBUUID(doc.JobID)).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion"}).
|
||||
AddRow(collectorID, database.MustToDBUUID(doc.JobID), minCleanVersion, minTextVersion),
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(collectorID, database.MustToDBUUID(doc.JobID), minCleanVersion, minTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
pool.ExpectQuery("name: ListResultsByDocumentID :many").WithArgs(database.MustToDBUUID(doc.ID), minCleanVersion, minTextVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "queryId", "queryVersion"}).
|
||||
AddRow(collectorID, queryID, qV),
|
||||
)
|
||||
pool.ExpectQuery("name: GetCollectorQueries :many").WithArgs(collectorID).
|
||||
pool.ExpectQuery("name: ListCollectorQueries :many").WithArgs(collectorID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"collectorId", "queryId", "type", "queryVersion", "requiredIds"}).
|
||||
AddRow(collectorID, queryID, repository.NullQuerytype{Querytype: repository.QuerytypeContextFull, Valid: true}, &qV, []pgtype.UUID{}),
|
||||
AddRow(collectorID, queryID, repository.QuerytypeContextFull, qV, []pgtype.UUID{}),
|
||||
)
|
||||
|
||||
err = runner.Process(ctx, msg)
|
||||
|
||||
Reference in New Issue
Block a user