storage/kubernetes: remove shadowed ResourceVersion from Connector (#1673)

This commit is contained in:
Kyle Travis 2020-04-07 05:02:44 -04:00 committed by GitHub
parent f6476b62f2
commit cfae2eb720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 21 deletions

View File

@ -594,7 +594,6 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
ID: id1,
Type: "Default",
Name: "Default",
ResourceVersion: "1",
Config: config1,
}
@ -612,7 +611,6 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
ID: id2,
Type: "Mock",
Name: "Mock",
ResourceVersion: "2",
Config: config2,
}
@ -626,6 +624,8 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
t.Errorf("get connector: %v", err)
return
}
// ignore resource version comparison
gr.ResourceVersion = ""
if diff := pretty.Compare(want, gr); diff != "" {
t.Errorf("connector retrieved from storage did not match: %s", diff)
}
@ -650,11 +650,15 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
t.Errorf("list connectors: %v", err)
return
}
// ignore resource version comparison
for i := range connectors {
connectors[i].ResourceVersion = ""
}
sort.Slice(connectors, func(i, j int) bool {
return connectors[i].Name < connectors[j].Name
})
if diff := pretty.Compare(want, connectors); diff != "" {
t.Errorf("password list retrieved from storage did not match: %s", diff)
t.Errorf("connector list retrieved from storage did not match: %s", diff)
}
}
listAndCompare(connectorList)

View File

@ -598,7 +598,6 @@ type Connector struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
// Config holds connector specific configuration information
Config []byte `json:"config,omitempty"`
}
@ -616,7 +615,6 @@ func (cli *client) fromStorageConnector(c storage.Connector) Connector {
ID: c.ID,
Type: c.Type,
Name: c.Name,
ResourceVersion: c.ResourceVersion,
Config: c.Config,
}
}
@ -626,7 +624,7 @@ func toStorageConnector(c Connector) storage.Connector {
ID: c.ID,
Type: c.Type,
Name: c.Name,
ResourceVersion: c.ResourceVersion,
ResourceVersion: c.ObjectMeta.ResourceVersion,
Config: c.Config,
}
}