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
2 changed files with 23 additions and 21 deletions

View File

@@ -591,11 +591,10 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
id1 := storage.NewID()
config1 := []byte(`{"issuer": "https://accounts.google.com"}`)
c1 := storage.Connector{
ID: id1,
Type: "Default",
Name: "Default",
ResourceVersion: "1",
Config: config1,
ID: id1,
Type: "Default",
Name: "Default",
Config: config1,
}
if err := s.CreateConnector(c1); err != nil {
@@ -609,11 +608,10 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
id2 := storage.NewID()
config2 := []byte(`{"redirectURIi": "http://127.0.0.1:5556/dex/callback"}`)
c2 := storage.Connector{
ID: id2,
Type: "Mock",
Name: "Mock",
ResourceVersion: "2",
Config: config2,
ID: id2,
Type: "Mock",
Name: "Mock",
Config: config2,
}
if err := s.CreateConnector(c2); err != nil {
@@ -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)