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

e2e: new ExitCleanly matcher #19802

Merged

Conversation

edsantiago
Copy link
Collaborator

e2e test logs are full of warning messages that we never see. Let's start looking for them.

This PR introduces a new gomega matcher, ExitCleanly(), with the purpose of replacing Should(Exit(0)). This matcher checks exit code and that no unexpected messages are emitted on stderr. Checking stdout is still up to the test writer.

As proof of concept, use the new matcher in play_build_test.go. This resulted in tests failing, because all those kube play commands have been spitting out warnings for lo all these years:

 time=.... level=warning msg="HEALTHCHECK is not supported for OCI image format and will be ignored. Must use `docker` format"

To remove that warning, use our standard system-test libpod/testimage:YYYYMMDD image instead of alpine_nginx. Image is now fetched and cached as part of standard test prep; I expect to use it much more in the future.

FWIW I tried updating play_kube_test.go but discovered and filed #19801, a bug that makes that impossible.

None

@openshift-ci openshift-ci bot added release-note-none approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 29, 2023
NGINX_IMAGE = "quay.io/lsm5/alpine_nginx-aarch64:latest" //nolint:revive,stylecheck
BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:revive,stylecheck
REGISTRY_IMAGE = "quay.io/libpod/registry:2.8.2" //nolint:revive,stylecheck
LABELS_IMAGE = "quay.io/libpod/alpine_labels:latest" //nolint:revive,stylecheck
CITEST_IMAGE = "quay.io/libpod/testimage:20221018" //nolint:revive,stylecheck
Copy link
Member

Choose a reason for hiding this comment

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

Two questions for further consideration. They don't need to be addressed for this PR.

  1. As this variable is referenced in at least two places, is there a place it could be added to and then pulled into here?

  2. Just looking at the testimage date. It's almost a year old, is it time to bump it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you rephrase question 1? I can't find a way to understand it. I'm sorry.

Bumping: absent any pressing need, bumping doesn't really gain us anything...

@TomSweeneyRedHat
Copy link
Member

LGTM
assuming happy tests

@edsantiago
Copy link
Collaborator Author

edsantiago commented Aug 30, 2023

Unsurprisingly, it got complicated. f38 root containerized is showing a ton of:

Unexpected warnings seen on stderr: "failed to connect to syslog: Initialization"

Looking deeper I see two things:

  1. This is happening all over, not just the tests with the new ExitCleanly(); and
  2. In one case, it's a flake. The test passes on second rerun.

This is not something I'll be able to fix.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Nice work!
LGTM

test/e2e/play_build_test.go Show resolved Hide resolved
Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM other than comments above.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, flouthoc

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:
  • OWNERS [edsantiago,flouthoc]

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

@edsantiago
Copy link
Collaborator Author

Filed #19809 for the syslog bug. This is blocked until that gets resolved.

Finally, after so many years, let's start using testimage:YYYYMMDD.
Use it in place of LABELS_IMAGE, which nothing/nowhere was using.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Combined test for (exitcode == 0) && (nothing on stderr).
Returns more useful diagnostic messages than the default:

  old: Expected N to equal 0

  new: Command failed with exit status N
  new: Unexpected warnings seen on stderr: "...."

Signed-off-by: Ed Santiago <santiago@redhat.com>
A nearly-trivial first effort to use the new ExitCleanly().
Requires using the new CITEST_IMAGE (see prior commit)
because nginx causes the tests to fail:

   [FAILED] Unexpected warnings seen on stderr: \
            level=warning \
            msg="HEALTHCHECK is not supported for OCI image format ...

Oh, I also took the liberty of rewriting "play kube" -> "kube play".

Signed-off-by: Ed Santiago <santiago@redhat.com>
Comment on lines +201 to +203
// FIXME: #19809, "failed to connect to syslog" warnings on f38
// FIXME: so, until that is fixed, don't check stderr if containerized
if !Containerized() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Given:

  1. I can't figure out where that warning is coming from; and
  2. enabling some testing is better than what we have now

...I've decided to kludge in a manual exception to skip warn-testing when running in container.

@containers/podman-maintainers please take another look

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM, great work!

@vrothberg
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 31, 2023
@openshift-merge-robot openshift-merge-robot merged commit 779bc49 into containers:main Aug 31, 2023
93 checks passed
@edsantiago edsantiago deleted the e2e_exit_cleanly_matcher branch August 31, 2023 14:15
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Nov 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants