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

View file

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