storage/kubernetes: remove shadowed ResourceVersion from Connector (#1673)
This commit is contained in:
parent
f6476b62f2
commit
cfae2eb720
@ -591,11 +591,10 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
|
|||||||
id1 := storage.NewID()
|
id1 := storage.NewID()
|
||||||
config1 := []byte(`{"issuer": "https://accounts.google.com"}`)
|
config1 := []byte(`{"issuer": "https://accounts.google.com"}`)
|
||||||
c1 := storage.Connector{
|
c1 := storage.Connector{
|
||||||
ID: id1,
|
ID: id1,
|
||||||
Type: "Default",
|
Type: "Default",
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
ResourceVersion: "1",
|
Config: config1,
|
||||||
Config: config1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.CreateConnector(c1); err != nil {
|
if err := s.CreateConnector(c1); err != nil {
|
||||||
@ -609,11 +608,10 @@ func testConnectorCRUD(t *testing.T, s storage.Storage) {
|
|||||||
id2 := storage.NewID()
|
id2 := storage.NewID()
|
||||||
config2 := []byte(`{"redirectURIi": "http://127.0.0.1:5556/dex/callback"}`)
|
config2 := []byte(`{"redirectURIi": "http://127.0.0.1:5556/dex/callback"}`)
|
||||||
c2 := storage.Connector{
|
c2 := storage.Connector{
|
||||||
ID: id2,
|
ID: id2,
|
||||||
Type: "Mock",
|
Type: "Mock",
|
||||||
Name: "Mock",
|
Name: "Mock",
|
||||||
ResourceVersion: "2",
|
Config: config2,
|
||||||
Config: config2,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.CreateConnector(c2); err != nil {
|
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)
|
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)
|
||||||
|
@ -595,10 +595,9 @@ type Connector struct {
|
|||||||
k8sapi.TypeMeta `json:",inline"`
|
k8sapi.TypeMeta `json:",inline"`
|
||||||
k8sapi.ObjectMeta `json:"metadata,omitempty"`
|
k8sapi.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
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"`
|
||||||
}
|
}
|
||||||
@ -613,11 +612,10 @@ func (cli *client) fromStorageConnector(c storage.Connector) Connector {
|
|||||||
Name: c.ID,
|
Name: c.ID,
|
||||||
Namespace: cli.namespace,
|
Namespace: cli.namespace,
|
||||||
},
|
},
|
||||||
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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user