Skip to content

unit tests: chmod setgid bit and allow skipping cloud tests#2937

Merged
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
dobsonj:azf-unit-test-fixes
Jan 13, 2026
Merged

unit tests: chmod setgid bit and allow skipping cloud tests#2937
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
dobsonj:azf-unit-test-fixes

Conversation

@dobsonj
Copy link
Copy Markdown
Member

@dobsonj dobsonj commented Jan 12, 2026

What type of PR is this?

/kind test

What this PR does / why we need it:

This PR includes two small commits to improve unit tests:

  • test: add option to skip unit tests that block on cloud provider

Some unit tests exercise back-end cloud provider functionality and take >1min to run per test, which can result in hitting the timeout. a7a17ca already bumped the timeout from 10m to 30m to help with this. However, we generally limit cloud provider tests to e2e, not unit tests. Ideally, it should be possible to run unit tests against the code without depending on availability of external services. This commit allows developers to optionally skip the long running tests with make unit-test UNIT_TEST_ARGS=-short

  • test: always chmod expected setgid bit in TestChmodIfPermissionMismatch

In one environment, TestChmodIfPermissionMismatch was failing 3 cases that expected setgid NOT to be set:

=== RUN   TestChmodIfPermissionMismatch
    utils_test.go:525: test[permission matching path]: unexpected gid bit: true, expected gid bit: false
    utils_test.go:525: test[permission mismatch path]: unexpected gid bit: true, expected gid bit: false
    utils_test.go:525: test[only change the permission mode bits when gid is not set but mode bits have gid set]: unexpected gid bit: true, expected gid bit: false
--- FAIL: TestChmodIfPermissionMismatch (0.00s)

The setgid bit was never specified and chmod was never called for these cases, so the test makes an assumption about the environment where it runs. This commit calls chmod to explicitly clear setgid for those test cases to avoid making assumptions about the default behavior.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

/cc @andyzhangx

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/test size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 12, 2026
@dobsonj dobsonj changed the title unit test fixes: chmod setgid bit and allow skipping cloud tests unit tests: chmod setgid bit and allow skipping cloud tests Jan 12, 2026
@dobsonj dobsonj force-pushed the azf-unit-test-fixes branch from da1ccf0 to bdf1b71 Compare January 12, 2026 18:54
Copy link
Copy Markdown
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 13, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, dobsonj

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

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2026
@k8s-ci-robot k8s-ci-robot merged commit 391f7ca into kubernetes-sigs:master Jan 13, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/test lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants