Commit Graph

16 Commits

Author SHA1 Message Date
Ed Santiago d4e40fedaf ExitWithError() - enforce required exit status & stderr
Final followup to #22270. That PR added a temporary convention
allowing a new form of ExitWithError(), one with an exit code
and stderr substring. In order to allow bite-size progress,
the old no-args form was still allowed. This PR removes
support for no-args ExitWithError().

This PR also adds one piece of new functionality: passing ""
(empty string) as the stderr arg means "expect exit code
but fail if there's anything at all in stderr".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-05-13 13:59:17 -06:00
Ed Santiago 2d9159821a e2e: redefine ExitWithError() to require exit code
...and an optional error-message string, to be checked
against stderr.

This is a starting point and baby-steps progress toward #18188.
There are 249 ExitWithError() checks in test/e2e. It will take
weeks to fix them all. This commit enables new functionality:

    Expect(ExitWithError(125, "expected substring"))

...while also allowing the current empty-args form. Once
all 249 empty-args uses are modernized, the matcher code
will be cleaned up.

I expect it will take several months of light effort to get
all e2e tests transitioned to the new form. I am choosing to
do so in pieces, for (relative) ease of review. This PR:

  1) makes the initial changes described above; and
  2) updates a small subset of e2e _test.go files such that:
     a) ExitWithError() is given an exit code and error string; and
     b) Exit(Nonzero) is changed to ExitWithError(Nonzero, "string")
        (when possible)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-04-10 06:35:52 -06:00
Paul Holzinger 74454bf59c
rework system connection and farm storage
We now no longer write containers.conf, instead system connections and
farms are written to a new file called podman-connections.conf.

This is a major rework and I had to change a lot of things to get this
to compile again with my c/common changes.

It is a breaking change for users as connections/farms added before this
commit can now no longer be removed or modified directly. However because
the logic keeps reading from containers.conf the old connections can
still be used to connect to a remote host.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-01-31 15:08:41 +01:00
Ed Santiago c90e9dad7a e2e: reenable warning checks on Debian
Back when we introduced ExitCleanly(), we couldn't use it
on Debian because of too many runc bugs. Now, early 2024:

 - #11784 has been closed-wontfix, so add a runc special-case
   in the specific test that triggers it.

 - #11785 seems to have gone away? Treat it as fixed.

 - #19552 is languishing, so let's just close-wontfix it too and
   add another runc special case.

 - and, one new rootless-cgroupsV1 exception for a warning msg
   that snuck in recently.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-01-07 18:00:54 -07:00
Ed Santiago c823d49fdc CI: unskip tests
New VMs have netavark 1.9, which fixes the "cannot talk to syslog"
warning when running containerized, so we can reenable clean-output
checks in containerized e2e tests

pasta: some new VMs have passt >= 2023-11-10, but f38 does not,
and f39 is unclear (my version extractor could not tell). So
I'm leaving the 20170 skip.

Debian runc now supports umask in *run*, but not *exec*. Even
with runc 1.1.10. And we don't even know what the situation is
on RHEL... so, run the podman-run umask tests but not exec.

Fixes: #19809

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-12-08 15:51:36 -07:00
Ed Santiago 8cb14e54a5 e2e: use ExitCleanly() in cleanup_test.go
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace.

Also, fix up the Containerized and Debian exceptions in matcher.
I was in a huge rush Thursday night when I added the Debian
exception. This, I hope, makes it slightly easier to understand
the cases where we don't check stderr.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-11 06:33:18 -06:00
Ed Santiago 65bddfcd25 e2e: use ExitCleanly() in checkpoint tests
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace, with one manual reversion (commented)

And -- duh! -- skip the stderr check on Debian!

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 20:20:28 -06:00
Ed Santiago 6cbd17c0f4 CI: e2e: new ginkgo matcher, ExitCleanly()
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>
2023-08-30 08:41:23 -06:00
Paul Holzinger 5b4af0584d
replace golint with revive linter
golint, scopelint and interfacer are deprecated. golint is replaced by
revive. This linter is better because it will also check for our error
style: `error strings should not be capitalized or end with punctuation or a newline`

scopelint is replaced by exportloopref (already endabled)
interfacer has no replacement but I do not think this linter is
important.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 15:12:33 +02:00
Valentin Rothberg 6c030cd573 fix a number of `godot` issues
Still an unknown number remains but I am running out of patience.
Adding dots is not the best use of my time.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg 0f12b6fe55 linter: enable nilerr
A number of cases looked suspicious, so I marked them with `FIXME`s to
leave some breadcrumbs.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Ed Santiago 8eb0be0a29 a few more manual BeTrue cleanups
Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-30 10:13:16 -07:00
Ed Santiago 12787963b0 e2e tests: more cleanup of BeTrue()s
Write a BeValidJSON() matcher, and replace IsJSONOutputValid():

  sed -i -e 's/Expect(\(.*\)\.IsJSONOutputValid()).To(BeTrue())/Expect(\1.OutputToString())\.To(BeValidJSON())/' test/e2e/*_test.go

(Plus a few manual tweaks)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-30 09:51:06 -07:00
Ed Santiago b63d696405 e2e tests: enable golint
...and fix problems found therewith.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-29 08:30:00 -07:00
Jhon Honce e907f095b2 test connection add
* Fix connection JSON encoding
* Add custom ginkgo matchers for connection testing
* Cleanup code

Fixes #11984

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-11-08 09:20:58 -07:00
Jhon Honce 60d0be17fc Refactor tests when checking for error exit codes
Rather than checking for non-zero, we need to check for >0 to
distinguish between timeouts and error exit codes.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-10-16 08:10:07 -07:00