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.
This commit is contained in:
1 parent
0670e272e3
commit
157f1a091b
1 file changed
+25
@@ -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{}{
|
||||
|
||||
Reference in new issue
Block a user