-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A Terminating pod is not ready (#528)
* terminating is not ready * tests * remove blackboxing from tests
- Loading branch information
Showing
6 changed files
with
65 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
changelog: | ||
- type: FIX | ||
issueLink: https://github.com/solo-io/go-utils/issues/529 | ||
resolvesIssue: true | ||
description: >- | ||
Revise kubectl tool to not report `Terminating` pods as `Running`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package testutils | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Kubernetes", func() { | ||
Context("WaitPodsRunning", func() { | ||
var ( | ||
ctx context.Context | ||
cancel context.CancelFunc | ||
) | ||
BeforeEach(func() { | ||
kubectlExecutable = `echo` | ||
ctx, cancel = context.WithDeadline(context.Background(), time.Now().Add(time.Second)) | ||
}) | ||
AfterEach(func() { | ||
cancel() | ||
}) | ||
It("Reports running pods as running", func() { | ||
kubectlArgs = []string{`"\ | ||
NAMESPACE NAME READY STATUS RESTARTS AGE \ | ||
kube-system coredns-5dd5756b68-62pwz 1/1 Running 0 3d18h" #`} | ||
|
||
// The parameters here don't really matter since we're not actually calling kubectl. | ||
// We do need a label however to enter the loop that calls the command. | ||
Expect(WaitPodsRunning(ctx, time.Millisecond, "", "foo=bar")).ToNot(HaveOccurred()) | ||
}) | ||
It("Doesn't report terminating pods as running", func() { | ||
kubectlArgs = []string{`"\ | ||
NAMESPACE NAME READY STATUS RESTARTS AGE \ | ||
kube-system coredns-5dd5756b68-jlm7r 1/1 Terminating 0 3d18h \ | ||
kube-system coredns-5dd5756b68-62pwz 1/1 Running 0 3d18h" #`} | ||
|
||
// The parameters here don't really matter since we're not actually calling kubectl. | ||
// We do need a label however to enter the loop that calls the command. | ||
Expect(WaitPodsRunning(ctx, time.Millisecond, "", "foo=bar")).To(MatchError(ContainSubstring("timed out waiting"))) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testutils_test | ||
package testutils | ||
|
||
import ( | ||
"testing" | ||
|