daemonset: Remove unnecessary error returns in strategy code

The nodeShouldRunDaemonPod method does not need to return an error
because there are no scenarios under which it fails. Remove the
error return path for its direct calls as well.
This commit is contained in:
Clayton Coleman
2021-01-27 21:47:41 -05:00
parent 9f296c133d
commit 8d8884a907
3 changed files with 18 additions and 48 deletions

View File

@@ -1983,7 +1983,6 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
nodeUnschedulable bool
ds *apps.DaemonSet
shouldRun, shouldContinueRunning bool
err error
}{
{
predicateName: "ShouldRunDaemonPod",
@@ -2262,7 +2261,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
manager.podNodeIndex.Add(p)
}
c.ds.Spec.UpdateStrategy = *strategy
shouldRun, shouldContinueRunning, err := manager.nodeShouldRunDaemonPod(node, c.ds)
shouldRun, shouldContinueRunning := manager.nodeShouldRunDaemonPod(node, c.ds)
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)
@@ -2270,9 +2269,6 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
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)
}
if err != c.err {
t.Errorf("[%v] strategy: %v, predicateName: %v expected err: %v, got: %v", i, c.predicateName, c.ds.Spec.UpdateStrategy.Type, c.err, err)
}
}
}
}