Merged in fature/jobs (pull request #34)
Job Collector * createstructure * mostupdatevalidation * repocollectorupdate * updateoutline * updatevalidation * scriptupdate * cleanupdockerignore * update * collectorupdateapi
This commit is contained in:
@@ -81,18 +81,18 @@ func TestNormalizeQueryIDs(t *testing.T) {
|
||||
}
|
||||
s := Service{db: db}
|
||||
|
||||
err = s.normalizeQueryIDs(ctx, nil)
|
||||
err = s.NormalizeQueryIDs(ctx, nil)
|
||||
assert.Nil(t, err)
|
||||
|
||||
entity := queryprocessor.Create{}
|
||||
|
||||
entity.RequiredQueryIDs = nil
|
||||
err = s.normalizeQueryIDs(ctx, &entity)
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, entity.RequiredQueryIDs)
|
||||
|
||||
entity.RequiredQueryIDs = &[]uuid.UUID{}
|
||||
err = s.normalizeQueryIDs(ctx, &entity)
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, entity.RequiredQueryIDs)
|
||||
|
||||
@@ -105,7 +105,7 @@ func TestNormalizeQueryIDs(t *testing.T) {
|
||||
AddRow(true),
|
||||
)
|
||||
|
||||
err = s.normalizeQueryIDs(ctx, &entity)
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Nil(t, err)
|
||||
assert.ElementsMatch(t, ids, *entity.RequiredQueryIDs)
|
||||
|
||||
@@ -114,16 +114,30 @@ func TestNormalizeQueryIDs(t *testing.T) {
|
||||
AddRow(false),
|
||||
)
|
||||
|
||||
err = s.normalizeQueryIDs(ctx, &entity)
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Error(t, err)
|
||||
assert.ElementsMatch(t, ids, *entity.RequiredQueryIDs)
|
||||
|
||||
pool.ExpectQuery("name: AllQueriesExist :one").WithArgs(dbids).
|
||||
WillReturnError(errors.New("database failure"))
|
||||
|
||||
err = s.normalizeQueryIDs(ctx, &entity)
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Error(t, err)
|
||||
assert.ElementsMatch(t, ids, *entity.RequiredQueryIDs)
|
||||
|
||||
singleid := uuid.New()
|
||||
entity.RequiredQueryIDs = &[]uuid.UUID{singleid, singleid}
|
||||
outids := []uuid.UUID{singleid}
|
||||
dbids = database.MustToDBUUIDArray(outids)
|
||||
|
||||
pool.ExpectQuery("name: AllQueriesExist :one").WithArgs(dbids).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"all_exist"}).
|
||||
AddRow(true),
|
||||
)
|
||||
|
||||
err = s.NormalizeQueryIDs(ctx, &entity)
|
||||
assert.Nil(t, err)
|
||||
assert.ElementsMatch(t, outids, *entity.RequiredQueryIDs)
|
||||
}
|
||||
|
||||
func TestNormalizeActiveVersion(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user