Merged in feature/textextract (pull request #108)
Start adding Textract + UUID changes * base * startclient * ts * short * tests
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
queryapi "queryorchestration/api/queryAPI"
|
||||
"queryorchestration/internal/collector"
|
||||
collectorset "queryorchestration/internal/collector/set"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/queue/clientsync"
|
||||
@@ -20,7 +19,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go-v2/service/sqs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -79,28 +77,28 @@ func TestSetCollector(t *testing.T) {
|
||||
|
||||
pool.ExpectQuery("name: GetClientByExternalId :one").WithArgs(id).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "externalId", "name", "can_sync"}).
|
||||
AddRow(database.MustToDBUUID(current.ClientID), id, "name", true),
|
||||
AddRow(current.ClientID, id, "name", true),
|
||||
)
|
||||
pool.ExpectQuery("name: GetCollectorByClientID :one").WithArgs(database.MustToDBUUID(current.ClientID)).
|
||||
pool.ExpectQuery("name: GetCollectorByClientID :one").WithArgs(current.ClientID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"clientId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(database.MustToDBUUID(current.ClientID), current.MinCleanVersion, current.MinTextVersion, current.ActiveVersion, current.LatestVersion, []byte("")),
|
||||
AddRow(current.ClientID, current.MinCleanVersion, current.MinTextVersion, current.ActiveVersion, current.LatestVersion, []byte("")),
|
||||
)
|
||||
pool.ExpectQuery("name: AllQueriesExist :one").WithArgs([]pgtype.UUID{database.MustToDBUUID((*body.Fields)[0].QueryId)}).
|
||||
pool.ExpectQuery("name: AllQueriesExist :one").WithArgs([]uuid.UUID{(*body.Fields)[0].QueryId}).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"exist"}).
|
||||
AddRow(true),
|
||||
)
|
||||
pool.ExpectBeginTx(pgx.TxOptions{})
|
||||
pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(database.MustToDBUUID(current.ClientID)).WillReturnRows(
|
||||
pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(current.ClientID).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"version"}).
|
||||
AddRow(int32(5)),
|
||||
)
|
||||
pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(database.MustToDBUUID(current.ClientID), int32(2)).
|
||||
pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(current.ClientID, int32(2)).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
pool.ExpectExec("name: SetCollectorCleanVersion :exec").WithArgs(database.MustToDBUUID(current.ClientID), int32(5), *body.MinimumCleanerVersion).
|
||||
pool.ExpectExec("name: SetCollectorCleanVersion :exec").WithArgs(current.ClientID, int32(5), *body.MinimumCleanerVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
pool.ExpectExec("name: AddCollectorQuery :exec").WithArgs(database.MustToDBUUID(current.ClientID), "a", database.MustToDBUUID((*body.Fields)[0].QueryId), int32(5)).
|
||||
pool.ExpectExec("name: AddCollectorQuery :exec").WithArgs(current.ClientID, "a", (*body.Fields)[0].QueryId, int32(5)).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
pool.ExpectCommit()
|
||||
|
||||
@@ -148,7 +146,7 @@ func TestGetCollectorByclientId(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByClientExternalID :one").WithArgs(id).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"clientId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(database.MustToDBUUID(coll.ClientID), coll.MinCleanVersion, coll.MinTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(coll.ClientID, coll.MinCleanVersion, coll.MinTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
|
||||
err = cons.GetCollectorByClientId(ctx, id)
|
||||
|
||||
Reference in New Issue
Block a user