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

Print pod logs for tests #19504

Merged
merged 1 commit into from
Apr 28, 2018

Conversation

imcsk8
Copy link
Contributor

@imcsk8 imcsk8 commented Apr 25, 2018

In order to help debugging problems print the pod log if the multicast test fails while launching the pod.

NOTE: ¿Should we look for a generic solution for printing pod logs in tests?

Fixes partially: rhbz#1557487

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 25, 2018
@imcsk8
Copy link
Contributor Author

imcsk8 commented Apr 25, 2018

PTAL @openshift/sig-networking

@openshift-ci-robot openshift-ci-robot added sig/networking size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 25, 2018
e2e.Failf("Error getting container logs: %s", logErr)
}

err = errors.New(err.Error() + logs)
Copy link
Contributor

Choose a reason for hiding this comment

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

hm... what does that end up looking like? (Don't you at least need a space or a newline between the original error and the logs?)

You could alternatively call e2e.Logf() to print the logs separately from returning the error...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it might be useful to have the container log added to the error string.

@danwinship
Copy link
Contributor

danwinship commented Apr 25, 2018

TODO: Print logs NetworkPolicy test.

as of #19130 we do

@imcsk8 imcsk8 force-pushed the multicast-pod-logs branch from a842eeb to 9e1fc6b Compare April 25, 2018 17:14
e2e.Failf("Error getting container logs: %s", logErr)
}

err = errors.New(err.Error() + "\nContainer Logs:\n" + logs)

Choose a reason for hiding this comment

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

This expects caller to log the error, why not log the podLogs here itself just like what we do in other places?
Prefer e2e.Failf() or e2e.LogF(), check https://github.com/openshift/origin/pull/19130/files for reference.

Choose a reason for hiding this comment

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

This will log more details for test case:

[Area:Networking] multicast when using one of the plugins 'redhat/openshift-ovs-multitenant, redhat/openshift-ovs-networkpolicy' should allow multicast traffic in namespaces where it is enabled [Suite:openshift/conformance/parallel] 5m10s

Don't we need similar code for this below test case?

NetworkPolicy when using a plugin that implements NetworkPolicy should enforce policy based on PodSelector [Feature:OSNetworkPolicy] [Suite:openshift/conformance/parallel] 1m12s

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears to be addressed in #19180

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need similar code for this below test case?

as I said above, it's already there (it just postdates the rhbz bug)

Copy link
Contributor

@danwinship danwinship Apr 25, 2018

Choose a reason for hiding this comment

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

(It's also possible that the NetworkPolicy flake was fixed by #19130)

@danwinship
Copy link
Contributor

Note that the multicast flake that inspired this is #19218 and there is a suggestion there about fixing it

@imcsk8 imcsk8 force-pushed the multicast-pod-logs branch from 9e1fc6b to 128fb10 Compare April 25, 2018 18:33
@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 25, 2018
@imcsk8 imcsk8 force-pushed the multicast-pod-logs branch from 128fb10 to bbee8fc Compare April 25, 2018 18:34
}
e2e.Failf("Could not launch pod %s\nPod logs:\n%s", podName, logs)
}

return podIP, err

Choose a reason for hiding this comment

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

Since error is already handled in the above block, this return is same as return podIP, nil (e2e.Failf in Line176 panics with useful info)
Either remove returning error from launchTestMulticastPod method or change Line176 to e2e.LogF()

In order to help debugging problems print the pod log
if the multicast test fails while launching the pod.

Add error check for pod logs

Fix framework reference

Format error message

Change pod logging to the general pattern

Fix typo

Change pod error logs
@imcsk8 imcsk8 force-pushed the multicast-pod-logs branch from bbee8fc to 481af8f Compare April 26, 2018 01:11
Copy link

@pravisankar pravisankar left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 26, 2018
@knobunc
Copy link
Contributor

knobunc commented Apr 26, 2018

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: imcsk8, knobunc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2018
@knobunc
Copy link
Contributor

knobunc commented Apr 26, 2018

/retest

1 similar comment
@imcsk8
Copy link
Contributor Author

imcsk8 commented Apr 27, 2018

/retest

@openshift-merge-robot openshift-merge-robot merged commit 032cbe9 into openshift:master Apr 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. sig/networking size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants