Skip to content

Refactor command/container/run.go#5693

Draft
laurazard wants to merge 8 commits intodocker:masterfrom
laurazard:run-refactor
Draft

Refactor command/container/run.go#5693
laurazard wants to merge 8 commits intodocker:masterfrom
laurazard:run-refactor

Conversation

@laurazard
Copy link
Member

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
The signal proxy forwards received signals to the container.

There's no need to start it so long before starting the container, so
move it closer to the `ContainerStart` call.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
There's no reason to use a non-cancellable context for the
`ContainerStart` call – this was previously only incidentally
non-cancellable, but in reality we probably want to be able to cancel
the start call.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
@laurazard laurazard added the kind/refactor PR's that refactor, or clean-up code label Dec 13, 2024
@laurazard laurazard self-assigned this Dec 13, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 71.95122% with 23 lines in your changes missing coverage. Please review.

Project coverage is 59.52%. Comparing base (5b36e1b) to head (3379da2).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5693      +/-   ##
==========================================
- Coverage   59.54%   59.52%   -0.02%     
==========================================
  Files         346      346              
  Lines       29379    29385       +6     
==========================================
- Hits        17494    17492       -2     
- Misses      10914    10919       +5     
- Partials      971      974       +3     

During an attached `docker run`, the CLI starts capturing signals so
that they can be forwarded to the container. The CLI stops capturing
signals after container is no longer running/it's streams are closed.

This test had two issues:
- it would close the streams early, causing the CLI to think the
  container had exited, and stop signal handling (causing the SIGINT
  to not be captured and interrupt the test instead), and
- it would send immediately on the status channel returned by WaitFunc,
  which would also signal the container has exited and caused the CLI to
  stop signal handling

This patch addresses both of these issues and makes this test less
flaky.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants