-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix API: Create container with an invalid configuration #6835
Conversation
Hi @zhangguanzhang. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Tests are not happy. |
@TomSweeneyRedHat PTAL |
@zhangguanzhang could you rebase and repush? I am under the impression that the CI had a hiccup. |
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'd love to see tests for this in test/apiv2
6a5d908
to
b69e496
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.
Please squash the two commits into one. The merge commit isn't necessary. I usually do git pull --rebase upstream/master
for rebasing.
Would you also add a test or two to test/apiv2
? As it's a fix, we missed to test it in the CI and only tests will make sure we that we don't regress on it in the future.
Again thanks a lot for fixing!
I'll try to add unit tests, and I'll submit them when I'm done |
8a1b7ee
to
4c8e640
Compare
test/apiv2/20-containers.at
Outdated
# Ensure that API does not occur: Create Container creates an invalid and the container fails to start | ||
# https://github.com/containers/libpod/issues/6799 | ||
CNAME=testArgs | ||
t POST libpod/containers/create?name=${CNAME} '{"Image":"'"$IMAGE"'"}'}' 200 |
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.
The tests take care of converting to JSON. The correct syntax here is:
t POST ... Image=$IMAGE
Also, the expected return status is 201, not 200
Also, please don't just check return code: add a check for reasonable status. Something like
.Id~[0-9a-f]\\{64\\}
Also, the /start
isn't working, I'll let you figure that out.
See test/apiv2/README.md
for instructions on how to run tests in your local environment.
52453e5
to
203f560
Compare
@edsantiago all has done:
run the test in my local environment:
|
@vrothberg ci error,but has no reason |
Sorry, we had some rough time with our CI, mainly with the infrastructure. Could you rebase and repush? |
I will try later |
@vrothberg It still error |
We're seeing it too. The infrastructure is sick but we're working on it. Thanks for your patience! |
Ok, please tell me when it's ready |
7b1a859
to
d59dfde
Compare
Signed-off-by: zhangguanzhang <[email protected]>
@rhatdan @vrothberg PTAL |
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, thanks a lot!
I want @edsantiago's ack on the test before merging.
@zhangguanzhang If you have time, can you take a look why publish all ports and port randomization aren't working properly for v2 api. If you create a container using api with just exposed port and publish all port flag set, ports won't be published. |
@skorhone I will take a look when I have time |
tests LGTM and address my earlier concerns. Thanks! |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, zhangguanzhang 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 |
A newly-added test in containers#6835 was flaking in CI with: not ok 143 [20-containers] DELETE libpod/containers/SHA 500 cannot remove container <sha> as it is running - running or paused containers cannot be removed without force: container state improper Root cause: DELETE being run immediately after container start. Although the container is short-lived, it does take time to run and exit. Solution: wait for container to exit (should be quick) before deleting. This gives us a new test for the /wait endpoint. Also: tweaked some comments for readability, removed unnecessary container ps, added actual container status checks, and added actual message checks to another test that was merely checking exit status. Signed-off-by: Ed Santiago <[email protected]>
Signed-off-by: zhangguanzhang [email protected]
fix #6799
if use API to create containers, this will be null