Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e73de49f
Commit
e73de49f
authored
Sep 27, 2014
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Caps on StatusReason*
parent
523731c5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
27 deletions
+27
-27
errors_test.go
pkg/api/errors/errors_test.go
+5
-5
types.go
pkg/api/types.go
+5
-5
types.go
pkg/api/v1beta1/types.go
+4
-4
types.go
pkg/api/v1beta2/types.go
+5
-5
types.go
pkg/api/v1beta3/types.go
+5
-5
apiserver_test.go
pkg/apiserver/apiserver_test.go
+1
-1
errors_test.go
pkg/apiserver/errors_test.go
+2
-2
No files found.
pkg/api/errors/errors_test.go
View file @
e73de49f
...
@@ -29,26 +29,26 @@ import (
...
@@ -29,26 +29,26 @@ import (
func
TestErrorNew
(
t
*
testing
.
T
)
{
func
TestErrorNew
(
t
*
testing
.
T
)
{
err
:=
NewAlreadyExists
(
"test"
,
"1"
)
err
:=
NewAlreadyExists
(
"test"
,
"1"
)
if
!
IsAlreadyExists
(
err
)
{
if
!
IsAlreadyExists
(
err
)
{
t
.
Errorf
(
"expected to be
already_exists"
)
t
.
Errorf
(
"expected to be
%s"
,
api
.
StatusReasonAlreadyExists
)
}
}
if
IsConflict
(
err
)
{
if
IsConflict
(
err
)
{
t
.
Errorf
(
"expected to not be
confict"
)
t
.
Errorf
(
"expected to not be
%s"
,
api
.
StatusReasonConflict
)
}
}
if
IsNotFound
(
err
)
{
if
IsNotFound
(
err
)
{
t
.
Errorf
(
fmt
.
Sprintf
(
"expected to not be %s"
,
api
.
StatusReasonNotFound
))
t
.
Errorf
(
fmt
.
Sprintf
(
"expected to not be %s"
,
api
.
StatusReasonNotFound
))
}
}
if
IsInvalid
(
err
)
{
if
IsInvalid
(
err
)
{
t
.
Errorf
(
"expected to not be
invalid"
)
t
.
Errorf
(
"expected to not be
%s"
,
api
.
StatusReasonInvalid
)
}
}
if
!
IsConflict
(
NewConflict
(
"test"
,
"2"
,
errors
.
New
(
"message"
)))
{
if
!
IsConflict
(
NewConflict
(
"test"
,
"2"
,
errors
.
New
(
"message"
)))
{
t
.
Errorf
(
"expected to be conflict"
)
t
.
Errorf
(
"expected to be conflict"
)
}
}
if
!
IsNotFound
(
NewNotFound
(
"test"
,
"3"
))
{
if
!
IsNotFound
(
NewNotFound
(
"test"
,
"3"
))
{
t
.
Errorf
(
"expected to be
not found"
)
t
.
Errorf
(
"expected to be
%s"
,
api
.
StatusReasonNotFound
)
}
}
if
!
IsInvalid
(
NewInvalid
(
"test"
,
"2"
,
nil
))
{
if
!
IsInvalid
(
NewInvalid
(
"test"
,
"2"
,
nil
))
{
t
.
Errorf
(
"expected to be
invalid"
)
t
.
Errorf
(
"expected to be
%s"
,
api
.
StatusReasonInvalid
)
}
}
}
}
...
...
pkg/api/types.go
View file @
e73de49f
...
@@ -522,7 +522,7 @@ const (
...
@@ -522,7 +522,7 @@ const (
// "Location" - HTTP header populated with a URL that can retrieved the final
// "Location" - HTTP header populated with a URL that can retrieved the final
// status of this operation.
// status of this operation.
// Status code 202
// Status code 202
StatusReasonWorking
StatusReason
=
"
w
orking"
StatusReasonWorking
StatusReason
=
"
W
orking"
// StatusReasonNotFound means one or more resources required for this operation
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// could not be found.
...
@@ -532,21 +532,21 @@ const (
...
@@ -532,21 +532,21 @@ const (
// resource.
// resource.
// "id" string - the identifier of the missing resource
// "id" string - the identifier of the missing resource
// Status code 404
// Status code 404
StatusReasonNotFound
StatusReason
=
"
not_f
ound"
StatusReasonNotFound
StatusReason
=
"
NotF
ound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
// Status code 409
StatusReasonAlreadyExists
StatusReason
=
"
already_e
xists"
StatusReasonAlreadyExists
StatusReason
=
"
AlreadyE
xists"
// StatusReasonConflict means the requested update operation cannot be completed
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// Each resource may define custom details that indicate the nature of the
// conflict.
// conflict.
// Status code 409
// Status code 409
StatusReasonConflict
StatusReason
=
"
c
onflict"
StatusReasonConflict
StatusReason
=
"
C
onflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// completed due to invalid data provided as part of the request. The client may
...
@@ -559,7 +559,7 @@ const (
...
@@ -559,7 +559,7 @@ const (
// provided resource that was invalid. The code, message, and
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// field attributes will be set.
// Status code 422
// Status code 422
StatusReasonInvalid
StatusReason
=
"
i
nvalid"
StatusReasonInvalid
StatusReason
=
"
I
nvalid"
)
)
// StatusCause provides more information about an api.Status failure, including
// StatusCause provides more information about an api.Status failure, including
...
...
pkg/api/v1beta1/types.go
View file @
e73de49f
...
@@ -538,7 +538,7 @@ const (
...
@@ -538,7 +538,7 @@ const (
// "Location" - HTTP header populated with a URL that can retrieved the final
// "Location" - HTTP header populated with a URL that can retrieved the final
// status of this operation.
// status of this operation.
// Status code 202
// Status code 202
StatusReasonWorking
StatusReason
=
"
w
orking"
StatusReasonWorking
StatusReason
=
"
W
orking"
// StatusReasonNotFound means one or more resources required for this operation
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// could not be found.
...
@@ -548,21 +548,21 @@ const (
...
@@ -548,21 +548,21 @@ const (
// resource.
// resource.
// "id" string - the identifier of the missing resource
// "id" string - the identifier of the missing resource
// Status code 404
// Status code 404
StatusReasonNotFound
StatusReason
=
"
n
otFound"
StatusReasonNotFound
StatusReason
=
"
N
otFound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
// Status code 409
StatusReasonAlreadyExists
StatusReason
=
"
a
lreadyExists"
StatusReasonAlreadyExists
StatusReason
=
"
A
lreadyExists"
// StatusReasonConflict means the requested update operation cannot be completed
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// Each resource may define custom details that indicate the nature of the
// conflict.
// conflict.
// Status code 409
// Status code 409
StatusReasonConflict
StatusReason
=
"
c
onflict"
StatusReasonConflict
StatusReason
=
"
C
onflict"
)
)
// StatusCause provides more information about an api.Status failure, including
// StatusCause provides more information about an api.Status failure, including
...
...
pkg/api/v1beta2/types.go
View file @
e73de49f
...
@@ -535,7 +535,7 @@ const (
...
@@ -535,7 +535,7 @@ const (
// "Location" - HTTP header populated with a URL that can retrieved the final
// "Location" - HTTP header populated with a URL that can retrieved the final
// status of this operation.
// status of this operation.
// Status code 202
// Status code 202
StatusReasonWorking
StatusReason
=
"
w
orking"
StatusReasonWorking
StatusReason
=
"
W
orking"
// StatusReasonNotFound means one or more resources required for this operation
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// could not be found.
...
@@ -545,21 +545,21 @@ const (
...
@@ -545,21 +545,21 @@ const (
// resource.
// resource.
// "id" string - the identifier of the missing resource
// "id" string - the identifier of the missing resource
// Status code 404
// Status code 404
StatusReasonNotFound
StatusReason
=
"
not_f
ound"
StatusReasonNotFound
StatusReason
=
"
NotF
ound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
// Status code 409
StatusReasonAlreadyExists
StatusReason
=
"
already_e
xists"
StatusReasonAlreadyExists
StatusReason
=
"
AlreadyE
xists"
// StatusReasonConflict means the requested update operation cannot be completed
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// Each resource may define custom details that indicate the nature of the
// conflict.
// conflict.
// Status code 409
// Status code 409
StatusReasonConflict
StatusReason
=
"
c
onflict"
StatusReasonConflict
StatusReason
=
"
C
onflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// completed due to invalid data provided as part of the request. The client may
...
@@ -572,7 +572,7 @@ const (
...
@@ -572,7 +572,7 @@ const (
// provided resource that was invalid. The code, message, and
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// field attributes will be set.
// Status code 422
// Status code 422
StatusReasonInvalid
StatusReason
=
"
i
nvalid"
StatusReasonInvalid
StatusReason
=
"
I
nvalid"
)
)
// StatusCause provides more information about an api.Status failure, including
// StatusCause provides more information about an api.Status failure, including
...
...
pkg/api/v1beta3/types.go
View file @
e73de49f
...
@@ -531,7 +531,7 @@ const (
...
@@ -531,7 +531,7 @@ const (
// "Location" - HTTP header populated with a URL that can retrieved the final
// "Location" - HTTP header populated with a URL that can retrieved the final
// status of this operation.
// status of this operation.
// Status code 202
// Status code 202
StatusReasonWorking
StatusReason
=
"
w
orking"
StatusReasonWorking
StatusReason
=
"
W
orking"
// StatusReasonNotFound means one or more resources required for this operation
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// could not be found.
...
@@ -541,21 +541,21 @@ const (
...
@@ -541,21 +541,21 @@ const (
// resource.
// resource.
// "id" string - the identifier of the missing resource
// "id" string - the identifier of the missing resource
// Status code 404
// Status code 404
StatusReasonNotFound
StatusReason
=
"
not_f
ound"
StatusReasonNotFound
StatusReason
=
"
NotF
ound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
// Status code 409
StatusReasonAlreadyExists
StatusReason
=
"
already_e
xists"
StatusReasonAlreadyExists
StatusReason
=
"
AlreadyE
xists"
// StatusReasonConflict means the requested update operation cannot be completed
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// Each resource may define custom details that indicate the nature of the
// conflict.
// conflict.
// Status code 409
// Status code 409
StatusReasonConflict
StatusReason
=
"
c
onflict"
StatusReasonConflict
StatusReason
=
"
C
onflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// completed due to invalid data provided as part of the request. The client may
...
@@ -568,7 +568,7 @@ const (
...
@@ -568,7 +568,7 @@ const (
// provided resource that was invalid. The code, message, and
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// field attributes will be set.
// Status code 422
// Status code 422
StatusReasonInvalid
StatusReason
=
"
i
nvalid"
StatusReasonInvalid
StatusReason
=
"
I
nvalid"
)
)
// StatusCause provides more information about an api.Status failure, including
// StatusCause provides more information about an api.Status failure, including
...
...
pkg/apiserver/apiserver_test.go
View file @
e73de49f
...
@@ -706,7 +706,7 @@ func TestAsyncCreateError(t *testing.T) {
...
@@ -706,7 +706,7 @@ func TestAsyncCreateError(t *testing.T) {
expectedStatus
:=
&
api
.
Status
{
expectedStatus
:=
&
api
.
Status
{
Status
:
api
.
StatusFailure
,
Status
:
api
.
StatusFailure
,
Code
:
http
.
StatusConflict
,
Code
:
http
.
StatusConflict
,
Reason
:
"
already_e
xists"
,
Reason
:
"
AlreadyE
xists"
,
Message
:
expectedErr
.
Error
(),
Message
:
expectedErr
.
Error
(),
Details
:
&
api
.
StatusDetails
{
Details
:
&
api
.
StatusDetails
{
Kind
:
"foo"
,
Kind
:
"foo"
,
...
...
pkg/apiserver/errors_test.go
View file @
e73de49f
...
@@ -39,7 +39,7 @@ func TestErrorsToAPIStatus(t *testing.T) {
...
@@ -39,7 +39,7 @@ func TestErrorsToAPIStatus(t *testing.T) {
errors
.
NewAlreadyExists
(
"foo"
,
"bar"
)
:
{
errors
.
NewAlreadyExists
(
"foo"
,
"bar"
)
:
{
Status
:
api
.
StatusFailure
,
Status
:
api
.
StatusFailure
,
Code
:
http
.
StatusConflict
,
Code
:
http
.
StatusConflict
,
Reason
:
"
already_e
xists"
,
Reason
:
"
AlreadyE
xists"
,
Message
:
"foo
\"
bar
\"
already exists"
,
Message
:
"foo
\"
bar
\"
already exists"
,
Details
:
&
api
.
StatusDetails
{
Details
:
&
api
.
StatusDetails
{
Kind
:
"foo"
,
Kind
:
"foo"
,
...
@@ -49,7 +49,7 @@ func TestErrorsToAPIStatus(t *testing.T) {
...
@@ -49,7 +49,7 @@ func TestErrorsToAPIStatus(t *testing.T) {
errors
.
NewConflict
(
"foo"
,
"bar"
,
stderrs
.
New
(
"failure"
))
:
{
errors
.
NewConflict
(
"foo"
,
"bar"
,
stderrs
.
New
(
"failure"
))
:
{
Status
:
api
.
StatusFailure
,
Status
:
api
.
StatusFailure
,
Code
:
http
.
StatusConflict
,
Code
:
http
.
StatusConflict
,
Reason
:
"
c
onflict"
,
Reason
:
"
C
onflict"
,
Message
:
"foo
\"
bar
\"
cannot be updated: failure"
,
Message
:
"foo
\"
bar
\"
cannot be updated: failure"
,
Details
:
&
api
.
StatusDetails
{
Details
:
&
api
.
StatusDetails
{
Kind
:
"foo"
,
Kind
:
"foo"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment