Merged in fature/jobs (pull request #34)
Job Collector * createstructure * mostupdatevalidation * repocollectorupdate * updateoutline * updatevalidation * scriptupdate * cleanupdockerignore * update * collectorupdateapi
This commit is contained in:
@@ -45,7 +45,7 @@ func TestSyncIsSynced(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(database.MustToDBUUID(doc.JobID)).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(database.MustToDBUUID(coll.ID), database.MustToDBUUID(coll.JobID), coll.MinCleanVersion, coll.MinTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(database.MustToDBUUID(coll.ID), database.MustToDBUUID(coll.JobID), &coll.MinCleanVersion, &coll.MinTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
pool.ExpectQuery("name: ListResultsByDocumentID :many").WithArgs(database.MustToDBUUID(doc.ID), coll.MinCleanVersion, coll.MinTextVersion).
|
||||
WillReturnRows(
|
||||
@@ -59,7 +59,7 @@ func TestSyncIsSynced(t *testing.T) {
|
||||
)
|
||||
|
||||
docSvc := document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.Nil(t, err)
|
||||
@@ -96,7 +96,7 @@ func TestSyncDBFail(t *testing.T) {
|
||||
)
|
||||
|
||||
docSvc := document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.EqualError(t, err, "no rows in result set")
|
||||
@@ -104,14 +104,14 @@ func TestSyncDBFail(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(dbJobID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(dbCollectorId, dbJobID, minCleanVersion, minTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(dbCollectorId, dbJobID, &minCleanVersion, &minTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
dbErr := "database failure"
|
||||
pool.ExpectQuery("name: ListResultsByDocumentID :many").WithArgs(database.MustToDBUUID(doc.ID), minCleanVersion, minTextVersion).
|
||||
WillReturnError(errors.New(dbErr))
|
||||
|
||||
docSvc = document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.EqualError(t, err, dbErr)
|
||||
@@ -119,7 +119,7 @@ func TestSyncDBFail(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(dbJobID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(dbCollectorId, dbJobID, minCleanVersion, minTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(dbCollectorId, dbJobID, &minCleanVersion, &minTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
pool.ExpectQuery("name: ListResultsByDocumentID :many").WithArgs(database.MustToDBUUID(doc.ID), minCleanVersion, minTextVersion).
|
||||
WillReturnRows(
|
||||
@@ -130,7 +130,7 @@ func TestSyncDBFail(t *testing.T) {
|
||||
WillReturnError(errors.New(dbErr))
|
||||
|
||||
docSvc = document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.EqualError(t, err, dbErr)
|
||||
@@ -138,7 +138,7 @@ func TestSyncDBFail(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(dbJobID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(dbCollectorId, dbJobID, minCleanVersion, minTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(dbCollectorId, dbJobID, &minCleanVersion, &minTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
qV := int32(1)
|
||||
reqID := database.MustToDBUUID(uuid.New())
|
||||
@@ -159,7 +159,7 @@ func TestSyncDBFail(t *testing.T) {
|
||||
WillReturnError(errors.New(dbErr))
|
||||
|
||||
docSvc = document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.EqualError(t, err, dbErr)
|
||||
@@ -193,7 +193,7 @@ func TestSync(t *testing.T) {
|
||||
pool.ExpectQuery("name: GetCollectorByJobID :one").WithArgs(dbJobID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "jobId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion", "fields"}).
|
||||
AddRow(dbCollectorId, dbJobID, minCleanVersion, minTextVersion, int32(1), int32(2), []byte("")),
|
||||
AddRow(dbCollectorId, dbJobID, &minCleanVersion, &minTextVersion, int32(1), int32(2), []byte("")),
|
||||
)
|
||||
pool.ExpectQuery("name: ListResultsByDocumentID :many").WithArgs(database.MustToDBUUID(doc.ID), minCleanVersion, minTextVersion).
|
||||
WillReturnRows(
|
||||
@@ -211,7 +211,7 @@ func TestSync(t *testing.T) {
|
||||
)
|
||||
|
||||
docSvc := document.New(db, &document.Services{
|
||||
Collector: collector.New(db),
|
||||
Collector: collector.New(db, &collector.Services{}),
|
||||
})
|
||||
err = docSvc.Sync(ctx, &doc)
|
||||
assert.EqualError(t, err, "JSON Extraction requires 1 result")
|
||||
|
||||
Reference in New Issue
Block a user