internal/host/plugin: add update catalog test for empty/same description (#1672)

This is to mainly get coverage on the empty description case, but it
follows the same logic as the "update name to same" test.
pull/1683/head
Chris Marchesi 5 years ago committed by GitHub
parent 0670e272e3
commit 157f1a091b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -612,6 +612,14 @@ func TestRepository_UpdateCatalog(t *testing.T) {
}
}
checkUpdateCatalogRequestNewDescriptionNil := func() checkFunc {
return func(t *testing.T, ctx context.Context) {
t.Helper()
assert := assert.New(t)
assert.Nil(gotOnUpdateCatalogRequest.NewCatalog.Description)
}
}
checkUpdateCatalogRequestCurrentAttributes := func(want map[string]interface{}) checkFunc {
return func(t *testing.T, ctx context.Context) {
t.Helper()
@ -808,6 +816,23 @@ func TestRepository_UpdateCatalog(t *testing.T) {
checkVerifyCatalogOplog(oplog.OpType_OP_TYPE_UPDATE),
},
},
{
name: "update description to same",
changeFuncs: []changeHostCatalogFunc{changeDescription("")},
version: 2,
fieldMask: []string{"description"},
wantCheckFuncs: []checkFunc{
checkVersion(2), // Version remains same even though row is updated
checkUpdateCatalogRequestCurrentDescriptionNil(),
checkUpdateCatalogRequestNewDescriptionNil(),
checkDescription(""),
checkSecrets(map[string]interface{}{
"one": "two",
}),
checkNumUpdated(1),
checkVerifyCatalogOplog(oplog.OpType_OP_TYPE_UPDATE),
},
},
{
name: "update attributes (add)",
changeFuncs: []changeHostCatalogFunc{changeAttributes(map[string]interface{}{

Loading…
Cancel
Save