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
0d8384c8
Commit
0d8384c8
authored
Oct 08, 2015
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace all executor_test timeouts by util.ForeverTestTimeout
parent
b629278d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
executor_test.go
contrib/mesos/pkg/executor/executor_test.go
+13
-12
No files found.
contrib/mesos/pkg/executor/executor_test.go
View file @
0d8384c8
...
@@ -45,6 +45,7 @@ import (
...
@@ -45,6 +45,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/dockertools"
"k8s.io/kubernetes/pkg/kubelet/dockertools"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch"
"github.com/mesos/mesos-go/mesosproto"
"github.com/mesos/mesos-go/mesosproto"
...
@@ -72,7 +73,7 @@ func TestExecutorRegister(t *testing.T) {
...
@@ -72,7 +73,7 @@ func TestExecutorRegister(t *testing.T) {
if
reflect
.
DeepEqual
(
initialPodUpdate
,
update
)
{
if
reflect
.
DeepEqual
(
initialPodUpdate
,
update
)
{
receivedInitialPodUpdate
=
true
receivedInitialPodUpdate
=
true
}
}
case
<-
time
.
After
(
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
}
}
assert
.
Equal
(
t
,
true
,
receivedInitialPodUpdate
,
assert
.
Equal
(
t
,
true
,
receivedInitialPodUpdate
,
"executor should have sent an initial PodUpdate "
+
"executor should have sent an initial PodUpdate "
+
...
@@ -163,7 +164,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -163,7 +164,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
select
{
select
{
case
<-
updates
:
case
<-
updates
:
case
<-
time
.
After
(
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"Executor should send an initial update on Registration"
)
t
.
Fatalf
(
"Executor should send an initial update on Registration"
)
}
}
...
@@ -193,7 +194,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -193,7 +194,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
executor
.
LaunchTask
(
mockDriver
,
taskInfo
)
executor
.
LaunchTask
(
mockDriver
,
taskInfo
)
assertext
.
EventuallyTrue
(
t
,
5
*
time
.
Second
,
func
()
bool
{
assertext
.
EventuallyTrue
(
t
,
util
.
ForeverTestTimeout
,
func
()
bool
{
executor
.
lock
.
Lock
()
executor
.
lock
.
Lock
()
defer
executor
.
lock
.
Unlock
()
defer
executor
.
lock
.
Unlock
()
return
len
(
executor
.
tasks
)
==
1
&&
len
(
executor
.
pods
)
==
1
return
len
(
executor
.
tasks
)
==
1
&&
len
(
executor
.
pods
)
==
1
...
@@ -205,7 +206,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -205,7 +206,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
if
len
(
update
.
Pods
)
==
1
{
if
len
(
update
.
Pods
)
==
1
{
gotPodUpdate
=
true
gotPodUpdate
=
true
}
}
case
<-
time
.
After
(
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
}
}
assert
.
Equal
(
t
,
true
,
gotPodUpdate
,
assert
.
Equal
(
t
,
true
,
gotPodUpdate
,
"the executor should send an update about a new pod to "
+
"the executor should send an update about a new pod to "
+
...
@@ -215,7 +216,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -215,7 +216,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
finished
:=
kmruntime
.
After
(
statusUpdateCalls
.
Wait
)
finished
:=
kmruntime
.
After
(
statusUpdateCalls
.
Wait
)
select
{
select
{
case
<-
finished
:
case
<-
finished
:
case
<-
time
.
After
(
5
*
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"timed out waiting for status update calls to finish"
)
t
.
Fatalf
(
"timed out waiting for status update calls to finish"
)
}
}
...
@@ -227,7 +228,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -227,7 +228,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
executor
.
KillTask
(
mockDriver
,
taskInfo
.
TaskId
)
executor
.
KillTask
(
mockDriver
,
taskInfo
.
TaskId
)
assertext
.
EventuallyTrue
(
t
,
5
*
time
.
Second
,
func
()
bool
{
assertext
.
EventuallyTrue
(
t
,
util
.
ForeverTestTimeout
,
func
()
bool
{
executor
.
lock
.
Lock
()
executor
.
lock
.
Lock
()
defer
executor
.
lock
.
Unlock
()
defer
executor
.
lock
.
Unlock
()
return
len
(
executor
.
tasks
)
==
0
&&
len
(
executor
.
pods
)
==
0
return
len
(
executor
.
tasks
)
==
0
&&
len
(
executor
.
pods
)
==
0
...
@@ -237,7 +238,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
...
@@ -237,7 +238,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
finished
=
kmruntime
.
After
(
statusUpdateCalls
.
Wait
)
finished
=
kmruntime
.
After
(
statusUpdateCalls
.
Wait
)
select
{
select
{
case
<-
finished
:
case
<-
finished
:
case
<-
time
.
After
(
5
*
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"timed out waiting for status update calls to finish"
)
t
.
Fatalf
(
"timed out waiting for status update calls to finish"
)
}
}
mockDriver
.
AssertExpectations
(
t
)
mockDriver
.
AssertExpectations
(
t
)
...
@@ -338,7 +339,7 @@ func TestExecutorStaticPods(t *testing.T) {
...
@@ -338,7 +339,7 @@ func TestExecutorStaticPods(t *testing.T) {
// wait for static pod to start
// wait for static pod to start
seenPods
:=
map
[
string
]
struct
{}{}
seenPods
:=
map
[
string
]
struct
{}{}
timeout
:=
time
.
After
(
time
.
Second
)
timeout
:=
time
.
After
(
util
.
ForeverTestTimeout
)
defer
mockDriver
.
AssertExpectations
(
t
)
defer
mockDriver
.
AssertExpectations
(
t
)
for
{
for
{
// filter by PodUpdate type
// filter by PodUpdate type
...
@@ -438,7 +439,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
...
@@ -438,7 +439,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
// when removing the task from k.tasks through the "task-lost:foo" message below.
// when removing the task from k.tasks through the "task-lost:foo" message below.
select
{
select
{
case
<-
called
:
case
<-
called
:
case
<-
time
.
After
(
5
*
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"timed out waiting for SendStatusUpdate for the running task"
)
t
.
Fatalf
(
"timed out waiting for SendStatusUpdate for the running task"
)
}
}
...
@@ -450,7 +451,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
...
@@ -450,7 +451,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
)
.
Return
(
mesosproto
.
Status_DRIVER_RUNNING
,
nil
)
.
Run
(
func
(
_
mock
.
Arguments
)
{
close
(
called
)
})
.
Once
()
)
.
Return
(
mesosproto
.
Status_DRIVER_RUNNING
,
nil
)
.
Run
(
func
(
_
mock
.
Arguments
)
{
close
(
called
)
})
.
Once
()
executor
.
FrameworkMessage
(
mockDriver
,
"task-lost:foo"
)
executor
.
FrameworkMessage
(
mockDriver
,
"task-lost:foo"
)
assertext
.
EventuallyTrue
(
t
,
5
*
time
.
Second
,
func
()
bool
{
assertext
.
EventuallyTrue
(
t
,
util
.
ForeverTestTimeout
,
func
()
bool
{
executor
.
lock
.
Lock
()
executor
.
lock
.
Lock
()
defer
executor
.
lock
.
Unlock
()
defer
executor
.
lock
.
Unlock
()
return
len
(
executor
.
tasks
)
==
0
&&
len
(
executor
.
pods
)
==
0
return
len
(
executor
.
tasks
)
==
0
&&
len
(
executor
.
pods
)
==
0
...
@@ -458,7 +459,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
...
@@ -458,7 +459,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
select
{
select
{
case
<-
called
:
case
<-
called
:
case
<-
time
.
After
(
5
*
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"timed out waiting for SendStatusUpdate"
)
t
.
Fatalf
(
"timed out waiting for SendStatusUpdate"
)
}
}
...
@@ -621,7 +622,7 @@ func TestExecutorsendFrameworkMessage(t *testing.T) {
...
@@ -621,7 +622,7 @@ func TestExecutorsendFrameworkMessage(t *testing.T) {
// guard against data race in mock driver between AssertExpectations and Called
// guard against data race in mock driver between AssertExpectations and Called
select
{
select
{
case
<-
called
:
// expected
case
<-
called
:
// expected
case
<-
time
.
After
(
5
*
time
.
Second
)
:
case
<-
time
.
After
(
util
.
ForeverTestTimeout
)
:
t
.
Fatalf
(
"expected call to SendFrameworkMessage"
)
t
.
Fatalf
(
"expected call to SendFrameworkMessage"
)
}
}
mockDriver
.
AssertExpectations
(
t
)
mockDriver
.
AssertExpectations
(
t
)
...
...
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