Fix secrets clearing bug in update. Changes to update count behavior for catalogs (#1691)

* Fix secret clearing bug in update.  Always return 1 catalog updated if we can find a catalog w/ a matching version.
This commit is contained in:
Todd authored and GitHub committed 2021-11-12 09:46:40 -07:00
1 parent 5cfcc41f00
commit b16ce175e5
6 files changed
+88 -15

No files matched your search

@@ -149,6 +149,9 @@ func TestCrud(t *testing.T) {
hc, err = hcClient.Read(tc.Context(), hc.Item.Id)
checkCatalog("read", hc.Item, err, "foo", 1)
hc, err = hcClient.Update(tc.Context(), hc.Item.Id, hc.Item.Version, hostcatalogs.WithName("foo"))
checkCatalog("update", hc.Item, err, "foo", 1)
hc, err = hcClient.Update(tc.Context(), hc.Item.Id, hc.Item.Version, hostcatalogs.WithName("bar"))
checkCatalog("update", hc.Item, err, "bar", 2)
@@ -180,6 +183,13 @@ func TestCrud(t *testing.T) {
c, err = hcClient.Update(tc.Context(), c.Item.Id, c.Item.Version, hostcatalogs.DefaultName())
checkCatalog("update", c.Item, err, "", 3)
c, err = hcClient.Update(tc.Context(), c.Item.Id, 0, hostcatalogs.WithAutomaticVersioning(true),
hostcatalogs.WithSecrets(map[string]interface{}{
"key1": "val1",
"key2": "val2",
}))
checkCatalog("update", c.Item, err, "", 4)
c, err = hcClient.Read(tc.Context(), c.Item.Id)
assert.NoError(err)