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
26e5c1d0
Commit
26e5c1d0
authored
Dec 15, 2014
by
Joe Beda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2928 from rajdeepd/master
Added test cases for Event Create and Event List
parents
c1d10826
a6fd5601
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
1 deletion
+82
-1
events_test.go
pkg/client/events_test.go
+82
-1
No files found.
pkg/client/events_test.go
View file @
26e5c1d0
...
...
@@ -23,6 +23,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
...
...
@@ -61,7 +62,6 @@ func TestEventCreate(t *testing.T) {
}
timeStamp
:=
util
.
Now
()
event
:=
&
api
.
Event
{
//namespace: namespace{"default"},
Status
:
"running"
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
...
...
@@ -85,3 +85,84 @@ func TestEventCreate(t *testing.T) {
t
.
Errorf
(
"%#v != %#v."
,
e
,
a
)
}
}
func
TestEventGet
(
t
*
testing
.
T
)
{
objReference
:=
&
api
.
ObjectReference
{
Kind
:
"foo"
,
Namespace
:
"nm"
,
Name
:
"objref1"
,
UID
:
"uid"
,
APIVersion
:
"apiv1"
,
ResourceVersion
:
"1"
,
}
timeStamp
:=
util
.
Now
()
event
:=
&
api
.
Event
{
Status
:
"running"
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
"/events/1"
,
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
event
},
}
response
,
err
:=
c
.
Setup
()
.
Events
(
""
)
.
Get
(
"1"
)
if
err
!=
nil
{
t
.
Errorf
(
"%#v should be nil."
,
err
)
}
if
e
,
r
:=
event
.
InvolvedObject
,
response
.
InvolvedObject
;
!
reflect
.
DeepEqual
(
e
,
r
)
{
t
.
Errorf
(
"%#v != %#v."
,
e
,
r
)
}
}
func
TestEventList
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
objReference
:=
&
api
.
ObjectReference
{
Kind
:
"foo"
,
Namespace
:
ns
,
Name
:
"objref1"
,
UID
:
"uid"
,
APIVersion
:
"apiv1"
,
ResourceVersion
:
"1"
,
}
timeStamp
:=
util
.
Now
()
eventList
:=
&
api
.
EventList
{
Items
:
[]
api
.
Event
{
{
Status
:
"running"
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
},
},
}
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"GET"
,
Path
:
"/events"
,
Body
:
nil
,
},
Response
:
Response
{
StatusCode
:
200
,
Body
:
eventList
},
}
response
,
err
:=
c
.
Setup
()
.
Events
(
ns
)
.
List
(
labels
.
Everything
(),
labels
.
Everything
())
if
err
!=
nil
{
t
.
Errorf
(
"%#v should be nil."
,
err
)
}
if
len
(
response
.
Items
)
!=
1
{
t
.
Errorf
(
"%#v response.Items should have len 1."
,
response
.
Items
)
}
responseEvent
:=
response
.
Items
[
0
]
if
e
,
r
:=
eventList
.
Items
[
0
]
.
InvolvedObject
,
responseEvent
.
InvolvedObject
;
!
reflect
.
DeepEqual
(
e
,
r
)
{
t
.
Errorf
(
"%#v != %#v."
,
e
,
r
)
}
}
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