storage/kubernetes: fix kubernetes storage conformance test failures
This commit is contained in:
parent
c76832eaea
commit
4be029c6c1
@ -135,6 +135,9 @@ func checkHTTPErr(r *http.Response, validStatusCodes ...int) error {
|
|||||||
if r.StatusCode == http.StatusNotFound {
|
if r.StatusCode == http.StatusNotFound {
|
||||||
return storage.ErrNotFound
|
return storage.ErrNotFound
|
||||||
}
|
}
|
||||||
|
if r.Request.Method == "POST" && r.StatusCode == http.StatusConflict {
|
||||||
|
return storage.ErrAlreadyExists
|
||||||
|
}
|
||||||
|
|
||||||
var url, method string
|
var url, method string
|
||||||
if r.Request != nil {
|
if r.Request != nil {
|
||||||
|
@ -31,7 +31,7 @@ const (
|
|||||||
resourceRefreshToken = "refreshtokens"
|
resourceRefreshToken = "refreshtokens"
|
||||||
resourceKeys = "signingkeies" // Kubernetes attempts to pluralize.
|
resourceKeys = "signingkeies" // Kubernetes attempts to pluralize.
|
||||||
resourcePassword = "passwords"
|
resourcePassword = "passwords"
|
||||||
resourceOfflineSessions = "offlinesessions"
|
resourceOfflineSessions = "offlinesessionses" // Again attempts to pluralize.
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config values for the Kubernetes storage type.
|
// Config values for the Kubernetes storage type.
|
||||||
|
@ -502,9 +502,14 @@ func (cli *client) fromStorageOfflineSessions(o storage.OfflineSessions) Offline
|
|||||||
}
|
}
|
||||||
|
|
||||||
func toStorageOfflineSessions(o OfflineSessions) storage.OfflineSessions {
|
func toStorageOfflineSessions(o OfflineSessions) storage.OfflineSessions {
|
||||||
return storage.OfflineSessions{
|
s := storage.OfflineSessions{
|
||||||
UserID: o.UserID,
|
UserID: o.UserID,
|
||||||
ConnID: o.ConnID,
|
ConnID: o.ConnID,
|
||||||
Refresh: o.Refresh,
|
Refresh: o.Refresh,
|
||||||
}
|
}
|
||||||
|
if s.Refresh == nil {
|
||||||
|
// Server code assumes this will be non-nil.
|
||||||
|
s.Refresh = make(map[string]*storage.RefreshTokenRef)
|
||||||
|
}
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user