-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
ExitWithError() - continue tightening #22346
ExitWithError() - continue tightening #22346
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pointing out a few areas that merit special attention
if IsRemote() { | ||
Expect(result).To(ExitWithError()) | ||
Expect(result.ErrorToString()).To(ContainSubstring("unknown flag")) | ||
result := podmanTest.Podman([]string{"import", "-q", outfile}) | ||
result.WaitWithDefaultTimeout() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Click the expand-up arrow. Note the SkipIfRemote()
.
@@ -197,7 +198,7 @@ var _ = Describe("Podman inspect", func() { | |||
}) | |||
|
|||
It("podman [image, container] inspect on container", func() { | |||
ctrName := "testCtr" | |||
ctrName := "testctr" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With caps, "image inspect" was barfing with "repository name must be lowercase"
test/e2e/load_test.go
Outdated
result = podmanTest.Podman([]string{"load", "-i", outfile}) | ||
result.WaitWithDefaultTimeout() | ||
Expect(result).Should(ExitCleanly()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judgment call: I could not figure out the point of this load
. That is already tested elsewhere.
test/e2e/logs_test.go
Outdated
@@ -595,14 +595,10 @@ var _ = Describe("Podman logs", func() { | |||
defer cleanup() | |||
logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "--log-opt", "tag=äöüß", ALPINE, "echo", "podman"}) | |||
logc.WaitWithDefaultTimeout() | |||
Expect(logc).To(Exit(126)) | |||
// FIXME-2023-09-26: conmon <2.1.8 logs to stdout; clean this up once >=2.1.8 is universal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conmon is 2.1.10 everywhere now.
dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"}) | ||
session := podmanTest.Podman([]string{"create", "--name", "testContainer", "--network", "bridge", ALPINE}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(ExitCleanly()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was completely broken. PLEASE REVIEW CAREFULLY! I don't know if this is the test intention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
@@ -427,15 +428,19 @@ var _ = Describe("Podman network create", func() { | |||
}) | |||
|
|||
It("podman network create with invalid IP", func() { | |||
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.0/17000", stringid.GenerateRandomID()}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another test that was completely broken. PLEASE REVIEW THIS CAREFULLY.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chnage looks good but you may want to rename the test to include ip-range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I do that, is it possible that I misunderstood the point of the test? What would you expect "invalid IP" to mean in the context of "network create"??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial gut was running a container with --ip that is not part of the network subnet but AFAIK we already have tests for that. I also see that we handle invalid subnet before in a different test, so that leaves --gateway which also accepts a ip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added gateway test. Renamed test.
}) | ||
|
||
It("podman network create with invalid network name", func() { | ||
nc := podmanTest.Podman([]string{"network", "create", "foo "}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space was making impossible to strcmp() error message. I could not figure out why.
dcc20c6
to
2a37039
Compare
test/e2e/load_test.go
Outdated
}) | ||
|
||
It("podman load bogus file", func() { | ||
save := podmanTest.Podman([]string{"load", "-i", "foobar.tar"}) | ||
save.WaitWithDefaultTimeout() | ||
Expect(save).To(ExitWithError()) | ||
Expect(save).To(ExitWithError(125, "stat foobar.tar: no such file or directory")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI all (most?) of these stat <name>: ...
will conflict with #22334 and need to be changed to faccessat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads-up. I've set to draft, to prevent this from merging. (Not that I expect it to pass remote/rootless/runc/etc tests anyway. I'm just trying to find out what the snags are).
dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"}) | ||
session := podmanTest.Podman([]string{"create", "--name", "testContainer", "--network", "bridge", ALPINE}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(ExitCleanly()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
@@ -427,15 +428,19 @@ var _ = Describe("Podman network create", func() { | |||
}) | |||
|
|||
It("podman network create with invalid IP", func() { | |||
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.0/17000", stringid.GenerateRandomID()}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chnage looks good but you may want to rename the test to include ip-range
2a37039
to
a554989
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG it passed CI. A few more special-attention-please comments from my part.
This is still blocked and draft because I don't want to collide with #22334 but I think it's ready for review. Once 22334 merges I will rebase, update error messages as needed, and then post whether my rebase-repush was trivial or if anything else noteworthy was necessary.
libpod/boltdb_state.go
Outdated
@@ -1234,7 +1234,7 @@ func (s *BoltState) networkModify(ctr *Container, network string, opts types.Per | |||
netConnected := ctrNetworksBkt.Get([]byte(network)) | |||
|
|||
if new && netConnected != nil { | |||
return fmt.Errorf("container %s is already connected to network %q: %w", ctr.ID(), network, define.ErrNetworkConnected) | |||
return fmt.Errorf("container %s is already connected to network %s: %w", ctr.ID(), network, define.ErrNetworkConnected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DANGER DANGER DANGER DANGER! I am mucking with non-test code! My thinking is, I would really like consistent error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this more consistent? The error 2 lines below still uses %q
.
I am in favor of consistency but I would argue this needs much broader vetting of error messages first and a consent from the team on what the right way way is, i.e. when to use %q vs %s, right now this seems rather arbitrarily chosen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant consistent between podman and podman-remote. Right now each one emits a different message, which is evil. I did not make that clear, and apologize for that.
I could instead add a conditional to the e2e test (if remote, Expect one thing, otherwise, Expect another). Or I could break this PR down into smaller parts. I'm tempted to do the latter. Suggestions welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How the hell do podman vs podman-remote generate different messages here? This error is coming straight from the db backend, are you sure this is remote vs local not boltdb vs sqlite?
I see what you are trying to do but IMO changing a few messages makes things worse unless we have a overall agreement first on what the right way to change it is. And IMO changing one message only while leaving others the same way makes podman error messages less consistent overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final (I hope) followup: I've removed my changes to the code base, and gone with if/else IsRemote() or boltb
conditionals in the tests. I find that distasteful but I hope it will let us move forward.
pkg/domain/infra/abi/containers.go
Outdated
@@ -525,7 +525,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st | |||
// ErrNoSuchCtr is non-fatal, other errors will be | |||
// treated as fatal. | |||
if errors.Is(err, define.ErrNoSuchCtr) { | |||
errs = append(errs, fmt.Errorf("no such container %s", name)) | |||
errs = append(errs, fmt.Errorf("no such container %q", name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
session.WaitWithDefaultTimeout() | ||
Expect(session).To(ExitWithError()) | ||
|
||
// FIXME-someday: figure out why message differs in podman-remote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, I tried, got nowhere. Probably five more minutes would've gotten me there but that's what I said three times before that already.
@@ -427,15 +428,19 @@ var _ = Describe("Podman network create", func() { | |||
}) | |||
|
|||
It("podman network create with invalid IP", func() { | |||
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.0/17000", stringid.GenerateRandomID()}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added gateway test. Renamed test.
Expect(session).Should(ExitWithError()) | ||
Expect(session.ErrorToString()).To(ContainSubstring("network not found")) | ||
expectMessage := fmt.Sprintf("network %s: ", netID[1:]) | ||
// FIXME-someday: figure out why this part does not show up in remote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another rathole
a554989
to
f42dfde
Compare
a9274d5
to
d01b207
Compare
Followup to containers#22270: wherever possible/practical, extend command error checks to include explicit exit status codes and error strings. Because containers#22346 is stalled, these are some trivial easy-to-review changes that get us closer to the goal. Signed-off-by: Ed Santiago <santiago@redhat.com>
Followup to [1]containers#22270: wherever possible/practical, extend command error checks to include explicit exit status codes and error strings. Just trying to shrink down containers#22346 to a manageable, reviewable size. Signed-off-by: Ed Santiago <santiago@redhat.com>
d01b207
to
0aca6a0
Compare
Ephemeral COPR build failed. @containers/packit-build please check. |
bf25023
to
734faf3
Compare
@containers/podman-maintainers should I split this into smaller chunks? |
I am fine with it, I have now reviewed everything anyway. Just noticed the one blocker above. |
734faf3
to
0eacdc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but we really should work on consistent error messages in the near future...
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, Luap99 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 |
Followup to containers#22270 : wherever possible/practical, extend command error checks to include explicit exit status codes and error strings. A small number of tests were broken, as in, not actually testing what they claimed to be testing. I've done my best to fix those. Signed-off-by: Ed Santiago <santiago@redhat.com>
0eacdc3
to
641cd7c
Compare
/lgtm |
Followup to #22270 : wherever possible/practical, extend command
error checks to include explicit exit status codes and error strings.
A small number of tests were broken, as in, not actually testing
what they claimed to be testing. I've done my best to fix those.
Signed-off-by: Ed Santiago santiago@redhat.com