Skip to content

Conversation

dcantah
Copy link
Member

@dcantah dcantah commented Jun 24, 2023

The point of this test is to see that we successfully can get all of the pids running in the container and they match the number expected, but for Windows this concept is a bit different. Windows containers essentially go through the usermode boot phase of the operating system, and have quite a few processes and system services running outside of the "init" process you specify. Because of this, there's not a great way to say "there should only be N processes running" like we can ensure
for Linux.

With all that said, on Windows check that we're at least greater than one ("init"+system services).

@dcantah dcantah marked this pull request as ready for review June 24, 2023 03:19
@containerd containerd deleted a comment from k8s-ci-robot Jun 24, 2023
@sparr
Copy link

sparr commented Jun 25, 2023

Can we not expect and test for >=N+1?

@dcantah
Copy link
Member Author

dcantah commented Jun 25, 2023

Yea we could do that, @sparr perhaps I misunderstood. Is the N the system services/processes? If so, not really. They're not static and there was a few times we discovered processes that didn't need to be running in a container context and removed them in the next tag of the image. This makes it hard to pinpoint the N 😐.

I've been thinking maybe we change the windows longCommand to 'cmd /c ping -t localhost' so there's two processes we launched, OR we launch an exec for windows in this test and just check that the two (init + exec) processes we launched exist. That changes this test quite a bit to accommodate Windows though.

Copy link
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

Looks good to me. It is better than what we have (just skipping any checks) at least :)

// 2 processes, 1 for sh and one for sleep
if l := len(processes); l != 2 {
} else {
if l != 2 {
Copy link
Member

Choose a reason for hiding this comment

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

Can you put the comment back here? ("2 processes, 1 for sh and one for sleep")

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep! I honestly missed that I nuked the comment..

Copy link
Member Author

Choose a reason for hiding this comment

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

@samuelkarp Fixed! Sorry for the delay

The point of this test is to see that we successfully can get all of
the pids running in the container and they match the number expected,
but for Windows this concept is a bit different. Windows containers
essentially go through the usermode boot phase of the operating system,
and have quite a few processes and system services running outside of
the "init" process you specify. Because of this, there's not a great
way to say "there should only be N processes running" like we can ensure
for Linux. So, on Windows check that we're at least greater than one.

Signed-off-by: Danny Canter <danny@dcantah.dev>
@dcantah dcantah force-pushed the testcontainerpids-windows branch from 0e73ac9 to 3c1e7ff Compare October 12, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants