Skip to content
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

ci: fix a race in TestExecIn and TestExecInTTY #4445

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lifubang
Copy link
Member

@lifubang lifubang commented Oct 14, 2024

Fixes: #4437
We can use a chan to wait the output from init process. After we received the content,
it means that the init process has started. Then we can exec into this container to use
ps command to check the init process and the exec process are both exist.

Signed-off-by: lifubang [email protected]

@kolyshkin
Copy link
Contributor

We can use a chan to wait the output from init process, after we received the content, it means that the init process has started. Then we can exec into this container to use ps command.

Please add this into the commit message.

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just not expect cat in ps output.

@kolyshkin
Copy link
Contributor

Maybe we should just not expect cat in ps output.

Or do a retry.

@lifubang
Copy link
Member Author

Maybe we should just not expect cat in ps output.

I think because these are integration tests, so maybe we need to keep this to check we didn't exec into an unrelated container?

Fixes: opencontainers#4437
We can use a chan to wait the output from init process. After we received the content,
it means that the init process has started. Then we can exec into this container to use
ps command to check the init process and the exec process are both exist.

Signed-off-by: lifubang <[email protected]>
Comment on lines +40 to +41
_ = stdoutR.Close()
_ = stdoutW.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just defer the close, instead of a function? We are ignoring the error anyways.

I mean it for all the cases, not just this.

_ = stdinR.Close()
defer stdinW.Close() //nolint: errcheck
defer func() {
_, _ = stdinW.Write([]byte("hello"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we write this? To stop the go routine? Can you add a comment or the message written can be self-explanatory instead of this hello?

If it's that, is it needed? Won't the close of the pipe already free the goroutine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: race in TestExecIn
3 participants