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
2777c8dd
Commit
2777c8dd
authored
Jun 08, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend logging for UnschedulableNodes
parent
1d128614
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
scheduler_test.go
test/integration/scheduler_test.go
+17
-7
No files found.
test/integration/scheduler_test.go
View file @
2777c8dd
...
@@ -103,13 +103,23 @@ func podScheduled(c *client.Client, podNamespace, podName string) wait.Condition
...
@@ -103,13 +103,23 @@ func podScheduled(c *client.Client, podNamespace, podName string) wait.Condition
// Wait till the passFunc confirms that the object it expects to see is in the store.
// Wait till the passFunc confirms that the object it expects to see is in the store.
// Used to observe reflected events.
// Used to observe reflected events.
func
waitForReflection
(
s
cache
.
Store
,
key
string
,
passFunc
func
(
n
interface
{})
bool
)
error
{
func
waitForReflection
(
t
*
testing
.
T
,
s
cache
.
Store
,
key
string
,
passFunc
func
(
n
interface
{})
bool
)
error
{
return
wait
.
Poll
(
time
.
Millisecond
*
10
,
time
.
Second
*
20
,
func
()
(
bool
,
error
)
{
nodes
:=
[]
*
api
.
Node
{}
err
:=
wait
.
Poll
(
time
.
Millisecond
*
100
,
wait
.
ForeverTestTimeout
,
func
()
(
bool
,
error
)
{
if
n
,
_
,
err
:=
s
.
GetByKey
(
key
);
err
==
nil
&&
passFunc
(
n
)
{
if
n
,
_
,
err
:=
s
.
GetByKey
(
key
);
err
==
nil
&&
passFunc
(
n
)
{
return
true
,
nil
return
true
,
nil
}
else
{
nodes
=
append
(
nodes
,
n
.
(
*
api
.
Node
))
return
false
,
nil
}
}
return
false
,
nil
})
})
if
err
!=
nil
{
t
.
Logf
(
"Logging consecutive node versions received from store:"
)
for
i
,
n
:=
range
nodes
{
t
.
Logf
(
"%d: %#v"
,
i
,
n
)
}
}
return
err
}
}
func
DoTestUnschedulableNodes
(
t
*
testing
.
T
,
restClient
*
client
.
Client
,
nodeStore
cache
.
Store
)
{
func
DoTestUnschedulableNodes
(
t
*
testing
.
T
,
restClient
*
client
.
Client
,
nodeStore
cache
.
Store
)
{
...
@@ -159,7 +169,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
...
@@ -159,7 +169,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
if
_
,
err
:=
c
.
Nodes
()
.
Update
(
n
);
err
!=
nil
{
if
_
,
err
:=
c
.
Nodes
()
.
Update
(
n
);
err
!=
nil
{
t
.
Fatalf
(
"Failed to update node with unschedulable=true: %v"
,
err
)
t
.
Fatalf
(
"Failed to update node with unschedulable=true: %v"
,
err
)
}
}
err
=
waitForReflection
(
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
err
=
waitForReflection
(
t
,
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
// An unschedulable node should get deleted from the store
// An unschedulable node should get deleted from the store
return
node
==
nil
return
node
==
nil
})
})
...
@@ -172,7 +182,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
...
@@ -172,7 +182,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
if
_
,
err
:=
c
.
Nodes
()
.
Update
(
n
);
err
!=
nil
{
if
_
,
err
:=
c
.
Nodes
()
.
Update
(
n
);
err
!=
nil
{
t
.
Fatalf
(
"Failed to update node with unschedulable=false: %v"
,
err
)
t
.
Fatalf
(
"Failed to update node with unschedulable=false: %v"
,
err
)
}
}
err
=
waitForReflection
(
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
err
=
waitForReflection
(
t
,
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Spec
.
Unschedulable
==
false
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Spec
.
Unschedulable
==
false
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -192,7 +202,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
...
@@ -192,7 +202,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
if
_
,
err
=
c
.
Nodes
()
.
UpdateStatus
(
n
);
err
!=
nil
{
if
_
,
err
=
c
.
Nodes
()
.
UpdateStatus
(
n
);
err
!=
nil
{
t
.
Fatalf
(
"Failed to update node with bad status condition: %v"
,
err
)
t
.
Fatalf
(
"Failed to update node with bad status condition: %v"
,
err
)
}
}
err
=
waitForReflection
(
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
err
=
waitForReflection
(
t
,
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Status
.
Conditions
[
0
]
.
Status
==
api
.
ConditionUnknown
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Status
.
Conditions
[
0
]
.
Status
==
api
.
ConditionUnknown
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -209,7 +219,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
...
@@ -209,7 +219,7 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
if
_
,
err
=
c
.
Nodes
()
.
UpdateStatus
(
n
);
err
!=
nil
{
if
_
,
err
=
c
.
Nodes
()
.
UpdateStatus
(
n
);
err
!=
nil
{
t
.
Fatalf
(
"Failed to update node with healthy status condition: %v"
,
err
)
t
.
Fatalf
(
"Failed to update node with healthy status condition: %v"
,
err
)
}
}
waitForReflection
(
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
err
=
waitForReflection
(
t
,
s
,
nodeKey
,
func
(
node
interface
{})
bool
{
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Status
.
Conditions
[
0
]
.
Status
==
api
.
ConditionTrue
return
node
!=
nil
&&
node
.
(
*
api
.
Node
)
.
Status
.
Conditions
[
0
]
.
Status
==
api
.
ConditionTrue
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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