Skip to content

Conversation

bobsira
Copy link

@bobsira bobsira commented Aug 26, 2025

  • Made chown-related tests portable: removed compile-time Unix-only assumptions, closed temp files, and used runtime checks + reflection so ownership assertions run only on platforms that expose Uid/Gid. This prevents Windows build failures and TempDir cleanup errors.
  • Adjusted behavior expectations for Windows SIDs (non-numeric Uid) so tests don't call strconv.Atoi on a SID.
  • Consolidated duplicated test loops to run each case once and avoid flaky/misleading failures.
  • Relaxed the process-kill test (TestTryKillOne) to treat any process termination as success and stop asserting on platform-specific Wait() error strings (Windows vs POSIX differences).

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot requested review from nirs and prezha August 26, 2025 12:56
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bobsira
Once this PR has been reviewed and has the lgtm label, please assign medyagh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 26, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @bobsira. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 26, 2025
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

if err := proc.Kill(); err != nil {
klog.Infof("Kill failed with %v - removing probably stale pid...", err)
return errors.Wrapf(err, "removing likely stale unkillable pid: %d", pid)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to do graceful termination,we should not add platform specific code in this file. We have a process package supporting both posix and windows. Can we use it here?

klog.Infof("Kill failed with %v - removing probably stale pid...", err)
return errors.Wrapf(err, "removing likely stale unkillable pid: %d", pid)
// On non-Windows try to send SIGUP first (graceful), fallback to kill if signaling fails.
// Use numeric syscall.Signal(1) (SIGUP) to avoid referencing platform-specific constant names.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not graceful shutdown on posix. Most processes do not handle SIGHUP but they expect SIGTERM as gracefull termination. Previous code did not do graceful termination, why do we ned to do this now?

// On POSIX we signal SIGHUP — child should exit cleanly.
if waitErr != nil {
t.Fatalf("unable to kill process: %v\n", waitErr)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not have platform specific code in this file. If we need different code for different platforms it should be implemented once in minikube. Can we add this code to the process package?

t.Fatalf("expected non-nil Wait error on windows, got nil")
}
} else {
// On POSIX we signal SIGHUP — child should exit cleanly.
Copy link
Contributor

Choose a reason for hiding this comment

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

SIGHUP is not graceful termination, we expect SIGTERM.

@bobsira
Copy link
Author

bobsira commented Aug 26, 2025

creating an issue to track all the windows failures here -> #21427

return errors.Wrapf(err, "removing likely stale unkillable pid: %d", pid)
// On non-Windows try to send SIGUP first (graceful), fallback to kill if signaling fails.
// Use numeric syscall.Signal(1) (SIGUP) to avoid referencing platform-specific constant names.
if runtime.GOOS != "windows" {
Copy link

Choose a reason for hiding this comment

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

you can just call err := process.Terminate(pid, "") and then handle it with if err != nil { ... }. the package is k8s.io/minikube/pkg/minikube/process

Copy link
Contributor

Choose a reason for hiding this comment

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

I would not use the process package if we don't have pid file. But maybe we an extend it to handle child processes where you know the pid and we don't need to verify that the pid exists.

@bobsira bobsira changed the title test: make chown tests cross-platform and relax TryKill test on Windows Fix for TestTryKillOne unit test failure on windows Aug 27, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 27, 2025
@medyagh
Copy link
Member

medyagh commented Aug 28, 2025

@bobsira plz see nirs comments and also rebase

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants