addressed comments
This commit is contained in:
@@ -1539,17 +1539,16 @@ func setDaemonSetCritical(ds *apps.DaemonSet) {
|
||||
}
|
||||
|
||||
func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
var shouldCreate, shouldContinueRunning bool
|
||||
shouldCreate = true
|
||||
shouldContinueRunning = true
|
||||
shouldRun := true
|
||||
shouldContinueRunning := true
|
||||
cases := []struct {
|
||||
predicateName string
|
||||
podsOnNode []*v1.Pod
|
||||
nodeCondition []v1.NodeCondition
|
||||
nodeUnschedulable bool
|
||||
ds *apps.DaemonSet
|
||||
wantToRun, shouldCreate, shouldContinueRunning bool
|
||||
err error
|
||||
predicateName string
|
||||
podsOnNode []*v1.Pod
|
||||
nodeCondition []v1.NodeCondition
|
||||
nodeUnschedulable bool
|
||||
ds *apps.DaemonSet
|
||||
shouldRun, shouldContinueRunning bool
|
||||
err error
|
||||
}{
|
||||
{
|
||||
predicateName: "ShouldRunDaemonPod",
|
||||
@@ -1564,7 +1563,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: true,
|
||||
shouldRun: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1580,7 +1579,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: shouldCreate,
|
||||
shouldRun: shouldRun,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1596,7 +1595,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: false,
|
||||
shouldRun: false,
|
||||
shouldContinueRunning: false,
|
||||
},
|
||||
{
|
||||
@@ -1629,7 +1628,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: shouldCreate,
|
||||
shouldRun: shouldRun,
|
||||
shouldContinueRunning: shouldContinueRunning,
|
||||
},
|
||||
{
|
||||
@@ -1657,7 +1656,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: shouldCreate, // This is because we don't care about the resource constraints any more and let default scheduler handle it.
|
||||
shouldRun: shouldRun, // This is because we don't care about the resource constraints any more and let default scheduler handle it.
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1685,7 +1684,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: true,
|
||||
shouldRun: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1703,7 +1702,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: false,
|
||||
shouldRun: false,
|
||||
shouldContinueRunning: false,
|
||||
},
|
||||
{
|
||||
@@ -1721,7 +1720,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: true,
|
||||
shouldRun: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1755,7 +1754,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: false,
|
||||
shouldRun: false,
|
||||
shouldContinueRunning: false,
|
||||
},
|
||||
{
|
||||
@@ -1789,7 +1788,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
shouldCreate: true,
|
||||
shouldRun: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
@@ -1806,7 +1805,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
},
|
||||
},
|
||||
nodeUnschedulable: true,
|
||||
shouldCreate: true,
|
||||
shouldRun: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
}
|
||||
@@ -1830,8 +1829,8 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
c.ds.Spec.UpdateStrategy = *strategy
|
||||
shouldRun, shouldContinueRunning, err := manager.nodeShouldRunDaemonPod(node, c.ds)
|
||||
|
||||
if shouldRun != c.shouldCreate {
|
||||
t.Errorf("[%v] strategy: %v, predicateName: %v expected shouldRun: %v, got: %v", i, c.ds.Spec.UpdateStrategy.Type, c.predicateName, c.shouldCreate, shouldRun)
|
||||
if shouldRun != c.shouldRun {
|
||||
t.Errorf("[%v] strategy: %v, predicateName: %v expected shouldRun: %v, got: %v", i, c.ds.Spec.UpdateStrategy.Type, c.predicateName, c.shouldRun, shouldRun)
|
||||
}
|
||||
if shouldContinueRunning != c.shouldContinueRunning {
|
||||
t.Errorf("[%v] strategy: %v, predicateName: %v expected shouldContinueRunning: %v, got: %v", i, c.ds.Spec.UpdateStrategy.Type, c.predicateName, c.shouldContinueRunning, shouldContinueRunning)
|
||||
|
Reference in New Issue
Block a user