Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
cfae2eb7
Unverified
Commit
cfae2eb7
authored
5 years ago
by
Kyle Travis
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
storage/kubernetes: remove shadowed ResourceVersion from Connector (#1673)
parent
f6476b62
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
storage/conformance/conformance.go
+15
-11
15 additions, 11 deletions
storage/conformance/conformance.go
storage/kubernetes/types.go
+8
-10
8 additions, 10 deletions
storage/kubernetes/types.go
with
23 additions
and
21 deletions
storage/conformance/conformance.go
+
15
−
11
View file @
cfae2eb7
...
...
@@ -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
(
"
passw
or
d
list retrieved from storage did not match: %s"
,
diff
)
t
.
Errorf
(
"
connect
or list retrieved from storage did not match: %s"
,
diff
)
}
}
listAndCompare
(
connectorList
)
...
...
This diff is collapsed.
Click to expand it.
storage/kubernetes/types.go
+
8
−
10
View file @
cfae2eb7
...
...
@@ -595,10 +595,9 @@ type Connector struct {
k8sapi
.
TypeMeta
`json:",inline"`
k8sapi
.
ObjectMeta
`json:"metadata,omitempty"`
ID
string
`json:"id,omitempty"`
Type
string
`json:"type,omitempty"`
Name
string
`json:"name,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
ID
string
`json:"id,omitempty"`
Type
string
`json:"type,omitempty"`
Name
string
`json:"name,omitempty"`
// Config holds connector specific configuration information
Config
[]
byte
`json:"config,omitempty"`
}
...
...
@@ -613,11 +612,10 @@ func (cli *client) fromStorageConnector(c storage.Connector) Connector {
Name
:
c
.
ID
,
Namespace
:
cli
.
namespace
,
},
ID
:
c
.
ID
,
Type
:
c
.
Type
,
Name
:
c
.
Name
,
ResourceVersion
:
c
.
ResourceVersion
,
Config
:
c
.
Config
,
ID
:
c
.
ID
,
Type
:
c
.
Type
,
Name
:
c
.
Name
,
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
,
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment