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
74a7179e
Commit
74a7179e
authored
Aug 12, 2014
by
brendandburns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #858 from lavalamp/fix
Fix flaky TestOpGet
parents
14f43f89
f220aa1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
apiserver_test.go
pkg/apiserver/apiserver_test.go
+6
-3
operation_test.go
pkg/apiserver/operation_test.go
+9
-1
No files found.
pkg/apiserver/apiserver_test.go
View file @
74a7179e
...
...
@@ -586,7 +586,7 @@ func expectApiStatus(t *testing.T, method, url string, data []byte, code int) *a
func
TestErrorsToAPIStatus
(
t
*
testing
.
T
)
{
cases
:=
map
[
error
]
api
.
Status
{
NewAlreadyExistsErr
(
"foo"
,
"bar"
)
:
api
.
Status
{
NewAlreadyExistsErr
(
"foo"
,
"bar"
)
:
{
Status
:
api
.
StatusFailure
,
Code
:
http
.
StatusConflict
,
Reason
:
"already_exists"
,
...
...
@@ -596,7 +596,7 @@ func TestErrorsToAPIStatus(t *testing.T) {
ID
:
"bar"
,
},
},
NewConflictErr
(
"foo"
,
"bar"
,
errors
.
New
(
"failure"
))
:
api
.
Status
{
NewConflictErr
(
"foo"
,
"bar"
,
errors
.
New
(
"failure"
))
:
{
Status
:
api
.
StatusFailure
,
Code
:
http
.
StatusConflict
,
Reason
:
"conflict"
,
...
...
@@ -719,9 +719,12 @@ func TestWriteRAWJSONMarshalError(t *testing.T) {
}
func
TestSyncCreateTimeout
(
t
*
testing
.
T
)
{
testOver
:=
make
(
chan
struct
{})
defer
close
(
testOver
)
storage
:=
SimpleRESTStorage
{
injectedFunction
:
func
(
obj
interface
{})
(
interface
{},
error
)
{
time
.
Sleep
(
5
*
time
.
Millisecond
)
// Eliminate flakes by ensuring the create operation takes longer than this test.
<-
testOver
return
obj
,
nil
},
}
...
...
pkg/apiserver/operation_test.go
View file @
74a7179e
...
...
@@ -140,7 +140,15 @@ func TestOperationsList(t *testing.T) {
}
func
TestOpGet
(
t
*
testing
.
T
)
{
simpleStorage
:=
&
SimpleRESTStorage
{}
testOver
:=
make
(
chan
struct
{})
defer
close
(
testOver
)
simpleStorage
:=
&
SimpleRESTStorage
{
injectedFunction
:
func
(
obj
interface
{})
(
interface
{},
error
)
{
// Eliminate flakes by ensuring the create operation takes longer than this test.
<-
testOver
return
obj
,
nil
},
}
handler
:=
New
(
map
[
string
]
RESTStorage
{
"foo"
:
simpleStorage
,
},
codec
,
"/prefix/version"
)
...
...
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