-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve exec api #858
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
Improve exec api #858
Conversation
6d96876 to
4049f3e
Compare
docker/api/exec_api.py
Outdated
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 line is longer than 80 characters :(
|
Regarding the integration test, it works fine for me locally: Is this a regression between 1.8 and 1.9? |
|
The integration tests on Jenkins use Docker 1.9.0 as well (see the |
|
Edit: ^ that doesn't make any sense, right? tty is allocated in container and exec api call just attaches to container so client doesn't need to allocate tty in test runner afaik |
ce60d28 to
704dbe8
Compare
|
After doing some brief testing the issue with integration test seems like race: First run: Then I reran the And again just a single failing test: And now it works for me locally. EDIT: passes now even locally in dind. |
|
Okay, so this is a python 3 only issue. |
704dbe8 to
1f4dfdc
Compare
|
Done! It was a race. Command in container didn't finish before tests tried to fetch results. Simple @shin- PTAL |
1f4dfdc to
178a84b
Compare
|
docker/api/exec_api.py
Outdated
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 is a bit harder to read than it needs to be. How about just:
if socket:
stream = TrueAlso, this is just a personal preference, but I prefer to modify arguments at the very top of a function, so it's all in one place, so ideally this would go above the bit where we initialise data.
178a84b to
36753f0
Compare
|
@aanand very good suggestions! code for tests looks a lot cleaner now, please take a look. |
36753f0 to
a1febd2
Compare
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
b/c if test fails, dpy-dind is left running and integration-dind target will refuse to start and you need to manually force-remove the container Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
a1febd2 to
98708c9
Compare
|
fixed the flake; rebased |
|
Apologies, I hadn't looked at the codebase in a while so I didn't realise it was copied. Your suggestion was a good one and the tests indeed look much better now, so thanks! I'd like to make one more suggestion, assuming it's possible - can the |
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
98708c9 to
a9a538a
Compare
No worries.
Done. |
|
LGTM |
1 similar comment
|
LGTM |
|
\o/ |
I'm sorry for creating new PR but git/GitHub went absolutely bananas: gh closed old PR itself (new UI glitch?), messed up commits and refused to do valid rebase.
Old PR: #853
Needed for: d11wtq/dockerpty#30
Transitively for: docker/compose#2023
I have addressed all comments:
Clientmethod) -- can rewrite if you don't like this (the reason I did it this way is that I didn't like the solution withpartialb/c you need to supply more arguments to_get_result_ttythan to_get_raw_response_socket)