Commit graph

22 commits

Author SHA1 Message Date
Daniel J Walsh 6f7a803d06
Cleanup display of trust with transports
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-22 15:08:58 -05:00
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
Ed Santiago c0a8814fb4 Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago 478f2da5d6 e2e tests: a little more minor cleanup
sed -i -e 's/Expect(\(.*\)\[\(\".*\"\)\])\.To(Equal(/Expect(\1).To(HaveKeyWithValue(\2, /' test/e2e/*_test.go

...with two manual tweaks, because this converted:

    Expect(foo["bar"]).To(Equal(""))
 -> Expect(foo).To(HaveKeyWithValue("bar",""))

It looks like the intention of the test was, instead:

    ...To(Not(HaveKey("bar")))

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -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
Miloslav Trmač adee084d65 Fix tests of podman image trust --raw and --json
Instead using the OS-wide system default policy, use
the one in this repo, and adjust the expected results
(as well as making the test stricter).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-10-25 18:02:41 +02:00
Miloslav Trmač 53ff49237b Tighten the expected output of the "podman image trust show" test
... to include all fields.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-10-25 18:02:41 +02:00
Miloslav Trmač c872788e4e Use INTEGRATION_ROOT instead of current directory
Should not change behavior, just to set a consistent
precedent for code introduced in future commits.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-10-25 18:02:41 +02:00
Ed Santiago 547fff2703 e2e tests: use Should(Exit()) and ExitWithError()
e2e test failures are rife with messages like:

   Expected 1 to equal 0

These make me cry. They're anti-helpful, requiring the reader
to dive into the source code to figure out what those numbers
mean.

Solution: Go tests have a '.Should(Exit(NNN))' mechanism. I
don't know if it spits out a better diagnostic (I have no way
to run e2e tests on my laptop), but I have to fantasize that
it will, and given the state of our flakes I assume that at
least one test will fail and give me the opportunity to see
what the error message looks like.

THIS IS NOT REVIEWABLE CODE. There is no way for a human
to review it. Don't bother. Maybe look at a few random
ones for sanity. If you want to really review, here is
a reproducer of what I did:

   cd test/e2e
   ! positive assertions. The second is the same as the first,
   ! with the addition of (unnecessary) parentheses because
   ! some invocations were written that way. The third is BeZero().
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\d+)\)\)/Expect($1).Should(Exit($2))/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(\(Equal\((\d+)\)\)\)/Expect($1).Should(Exit($2))/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(BeZero\(\)\)/Expect($1).Should(Exit(0))/' *_test.go

   ! Same as above, but handles three non-numeric exit codes
   ! in run_exit_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\S+)\)\)/Expect($1).Should(Exit($2))/' *_test.go

   ! negative assertions. Difference is the spelling of 'To(Not)',
   ! 'ToNot', and 'NotTo'. I assume those are all the same.
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Not\(Equal\((0)\)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.NotTo\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   ! negative, old use of BeZero()
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(BeZero\(\)\)/Expect($1).Should(ExitWithError())/' *_test.go

Run those on a clean copy of main branch (at the same branch
point as my PR, of course), then diff against a checked-out
copy of my PR. There should be no differences. Then all you
have to review is that my replacements above are sane.

UPDATE: nope, that's not enough, you also need to add gomega/gexec
to the files that don't have it:

   perl -pi -e '$_ .= "$1/gexec\"\n" if m!^(.*/onsi/gomega)"!' $(grep -L gomega/gexec $(git log -1 --stat | awk '$1 ~ /test\/e2e\// { print $1}'))

UPDATE 2: hand-edit run_volume_test.go

UPDATE 3: sigh, add WaitWithDefaultTimeout() to a couple of places

UPDATE 4: skip a test due to bug #10935 (race condition)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-07-15 05:06:33 -06:00
Valentin Rothberg 5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
Daniel J Walsh 3b6d7a3669
Remove build \!remote flags from test phase 2
Add some more tests, document cases where remote will not work
Add FIXMEs for tests that should work on podman-remote but currently
do not.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 13:02:44 -05:00
Paul Holzinger a261819183 Fix podman image trust show --raw output
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-10-15 19:04:57 +02:00
Ed Santiago 318336ad4b flake fix: podman image trust
The output of 'podman image trust' is in random order; but
its e2e test was assuming a specific one. This caused flakes.

Fixes: #6764

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-08-18 09:12:36 -06:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
Daniel J Walsh a10d5b42ab
Change buildtag for remoteclient to remote for testing
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-06 15:22:24 -04:00
Valentin Rothberg 8489dc4345 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules.  While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
`github.com/containers/libpod/v2`.  The renaming of the imports
was done via `gomove` [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:50:12 +02:00
baude e9a17da1c5 v2trust set and show
add podman image trust set and show

Signed-off-by: baude <bbaude@redhat.com>
Signed-off-by: bbaude <bbaude@DESKTOP-SH5EG3J.localdomain>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-07 09:55:52 -05:00
Brent Baude 5c968b7693 Force integration tests to pass
Failing tests are now skipped and we should work from this.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-21 13:48:50 -05:00
baude f610a485c1 use imagecaches for local tests
when doing localized tests (not varlink), we can use secondary image
stores as read-only image caches.  this cuts down on test time
significantly because each test does not need to restore the images from
a tarball anymore.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-29 15:12:05 -05:00
baude d5546008ab ginkgo status improvements
a series of improvements to our ginkgo test framework so we can
get better ideas of whats going on when run in CI

Signed-off-by: baude <bbaude@redhat.com>
2019-03-08 13:28:33 -06:00
baude b30a56c156 Run integrations test with remote-client
Add the ability to run the integration (ginkgo) suite using
the remote client.

Only the images_test.go file is run right now; all the rest are
isolated with a // +build !remotelinux.  As more content is
developed for the remote client, we can unblock the files and
just block single tests as needed.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-14 14:51:32 -06:00
Qi Wang 31edf47285 Support podman image trust command
Display the trust policy of the host system. The trust policy is stored in the /etc/containers/policy.json file and defines a scope of registries or repositories.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2018-12-19 13:36:11 -05:00