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

Wait for pod to be running in e2e test #11444

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
16 changes: 12 additions & 4 deletions test/end-to-end/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,22 @@ os::cmd::expect_success 'oc whoami'

echo "[INFO] Running a CLI command in a container using the service account"
os::cmd::expect_success 'oc policy add-role-to-user view -z default'
oc run cli-with-token --attach --image="openshift/origin:${TAG}" --restart=Never -- cli status --loglevel=4 > "${LOG_DIR}/cli-with-token.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'Using in-cluster configuration'

Copy link
Contributor

Choose a reason for hiding this comment

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

if oc run --attach doesn't work any more, we have to fix that, not work around the issue in a test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--attach makes the command watch for events until it notices that the pod is running and then it attaches to the container. This is not a workaround because --attach is not working, but because of the pod never transitioning to Running (#11016).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the error reported in #11240

Standard output from the command:
Waiting for pod test/cli-with-token to be running, status is Pending, pod ready: false
Waiting for pod test/cli-with-token to be running, status is Pending, pod ready: false

Copy link
Contributor

@ncdc ncdc Oct 19, 2016

Choose a reason for hiding this comment

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

@Kargakis I don't think the assessment is correct, at least not in cases such as this one: https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_integration/7303/console.

Running test/end-to-end/core.sh:328: executing 'oc policy add-role-to-user view -z default' expecting success...
SUCCESS after 0.261s: test/end-to-end/core.sh:328: executing 'oc policy add-role-to-user view -z default' expecting success
There was no output from the command.
There was no error output from the command.
Running test/end-to-end/core.sh:330: executing 'cat '/tmp/openshift/test-end-to-end-docker//logs/cli-with-token.log'' expecting success and text 'Using in-cluster configuration'...
FAILURE after 0.014s: test/end-to-end/core.sh:330: executing 'cat '/tmp/openshift/test-end-to-end-docker//logs/cli-with-token.log'' expecting success and text 'Using in-cluster configuration': the output content test failed
Standard output from the command:
Waiting for pod test/cli-with-token to be running, status is Pending, pod ready: false
Waiting for pod test/cli-with-token to be running, status is Pending, pod ready: false
If you don't see a command prompt, try pressing enter.
In project test on server https://172.30.0.1:443

pod/cli-with-token runs openshift/origin:f0d40dd

2 warnings identified, use 'openshift cli status -v' to see details.
Waiting for pod test/cli-with-token to terminate, status is Running

There was no error output from the command.

Here you see it did run, it just failed to capture this output (what I see locally):

I1019 14:12:48.070810       1 merged_client_builder.go:122] Using in-cluster configuration

This is logged after the "Waiting for pod" line and before the "In project test" line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I can see those logs anyway too. That's unfortunate. I am not sure if this is related or not to --attach now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe related failure: #9285 (comment)

os::cmd::expect_success "oc run cli-with-token --image=\"openshift/origin:${TAG}\" --restart=Never -- cli status"
os::cmd::try_until_text 'oc get pod cli-with-token -o jsonpath="{.status.phase}"' "Succeeded"
oc logs pods/cli-with-token > "${LOG_DIR}/cli-with-token.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'In project test'
os::cmd::expect_success 'oc delete pod cli-with-token'
oc run cli-with-token-2 --attach --image="openshift/origin:${TAG}" --restart=Never -- cli whoami --loglevel=4 > "${LOG_DIR}/cli-with-token2.log" 2>&1

os::cmd::expect_success "oc run cli-with-token-2 --image=\"openshift/origin:${TAG}\" --restart=Never -- cli whoami"
os::cmd::try_until_text 'oc get pod cli-with-token-2 -o jsonpath="{.status.phase}"' "Succeeded"
oc logs pods/cli-with-token-2 > "${LOG_DIR}/cli-with-token2.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token2.log'" 'system:serviceaccount:test:default'
os::cmd::expect_success 'oc delete pod cli-with-token-2'
oc run kubectl-with-token --attach --image="openshift/origin:${TAG}" --restart=Never --command -- kubectl get pods --loglevel=4 > "${LOG_DIR}/kubectl-with-token.log" 2>&1

os::cmd::expect_success "oc run kubectl-with-token --image=\"openshift/origin:${TAG}\" --restart=Never --command -- kubectl get pods --loglevel=4"
os::cmd::try_until_text 'oc get pod kubectl-with-token -o jsonpath="{.status.phase}"' "Succeeded"
oc logs pods/kubectl-with-token > "${LOG_DIR}/kubectl-with-token.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'Using in-cluster configuration'
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'kubectl-with-token'

Expand Down