Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure ContainerStatus in PNS is terminated before continuing #4469

Merged
merged 6 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test
Signed-off-by: Simon Behar <[email protected]>
  • Loading branch information
simster7 committed Nov 6, 2020
commit b9fb9417fd1b80d8428456c5226b24ec80bba0f5
32 changes: 32 additions & 0 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,38 @@ spec:
DeleteMemoryQuota()
}

func (s *FunctionalSuite) TestExitCodePNSSleep() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: cond
labels:
argo-e2e: true
spec:
entrypoint: conditional-example
templates:
- name: conditional-example
steps:
- - name: print-hello
template: whalesay
- name: whalesay
container:
image: argoproj/argosay:v2
args: [sleep, 5s]
`).
When().
SubmitWorkflow().
Wait(10 * time.Second).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
node := status.Nodes.FindByDisplayName("print-hello")
if assert.NotNil(t, node) && assert.NotNil(t, node.Outputs) && assert.NotNil(t, node.Outputs.ExitCode) {
assert.Equal(t, "0", *node.Outputs.ExitCode)
}
})
}

func TestFunctionalSuite(t *testing.T) {
suite.Run(t, new(FunctionalSuite))
}
2 changes: 1 addition & 1 deletion workflow/executor/pns/pns.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (p *PNSExecutor) updateCtrIDMap() {
func (p *PNSExecutor) GetTerminatedContainerStatus(containerID string) (*corev1.Pod, *corev1.ContainerStatus, error) {
var pod *corev1.Pod
var containerStatus *corev1.ContainerStatus
err := wait.Poll(500*time.Millisecond, 2*time.Second, func() (bool, error) {
err := wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this try 3 times over 3 seconds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. According to my manual testing, this should succeed on the first try around 95% of the time. It should almost always succeed by the second try.

podRes, err := p.clientset.CoreV1().Pods(p.namespace).Get(p.podName, metav1.GetOptions{})
if err != nil {
return false, fmt.Errorf("could not get pod: %s", err)
Expand Down