Skip to content

OCPBUGS-99695: Add TC 88940- Apply password only if changes exist - #6328

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ptalgulk01:ppt/ocp-88940
Jul 24, 2026
Merged

OCPBUGS-99695: Add TC 88940- Apply password only if changes exist#6328
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ptalgulk01:ppt/ocp-88940

Conversation

@ptalgulk01

@ptalgulk01 ptalgulk01 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • What I did

Added e2e test OCP-88940 to verify that MCD applies password usermod only when the password hash actually changes (OCPBUGS-83830).

The test covers:

  1. Apply a MachineConfig with passwordHash for the core user → verify "Password has been configured" appears in MCD logs
  2. Update the passwordHash to a different value → verify "Password has been configured" appears again
  3. Add an SSH key without changing the password hash → verify "Password has been configured" does not appear (the key assertion for the bug fix)
  4. Verify no drain or reboot events are triggered throughout
  • How to verify it
 make machine-config-tests-ext
 ./_output/linux/amd64/machine-config-tests-ext list | grep 88940
  • Run on a cluster:
    ./_output/linux/amd64/machine-config-tests-ext run --test "PolarionID:88940"

  • Description for the changelog
    Add e2e test OCP-88940 validating MCD only runs password usermod when the hash changes, not on unrelated passwd section updates like SSH key additions.

Summary by CodeRabbit

  • Tests
    • Added a new disruptive long-duration test for applying password changes only when updates exist, confirming the expected Machine Config Daemon log output.
    • Verified that initial password-hash deployment skips drain/reboot, and that subsequent password-hash replacement increases the log occurrence count appropriately.
    • Ensured that updating the user configuration with an added SSH public key (while keeping the updated password hash) does not increase the password-configured log count and does not trigger drain or reboot.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Walkthrough

Adds a disruptive test verifying password updates when the password hash changes, while SSH-key-only updates do not reconfigure the password or trigger drain/reboot operations.

Changes

Password update validation

Layer / File(s) Summary
Password and SSH update behavior
test/extended-priv/mco_password.go
Adds a disruptive test for initial password configuration, password-hash replacement, SSH key application with an unchanged hash, MCD log counts, and skipped drain/reboot events.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: proietfb, umohnani8

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The test’s initial log check lacks a pre-apply baseline, and one patch error message leaves a %s placeholder unresolved. Capture the MCD log count before mc.create() and compare against that baseline; also pass mc.GetName() into the patch failure message.
Microshift Test Compatibility ⚠️ Warning New It uses MCO MachineConfig/MachineConfigPool (machineconfiguration.openshift.io) and has no [apigroup]/[Skipped:MicroShift]/runtime guard. Add an [apigroup:machineconfiguration.openshift.io] tag or a MicroShift skip/guard, or move the test off MicroShift-incompatible MCO APIs.
✅ Passed checks (13 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The new Ginkgo title is a static string with only fixed labels/IDs; no dynamic names, timestamps, or run-specific values appear in test titles.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new test uses GetCompactCompatiblePool() (returns master on SNO) and only targets one node; it has no multi-node, rescheduling, or HA-only assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only an e2e test was added; no deployment manifests, operator code, or controllers, so no new scheduling constraints to review.
Ote Binary Stdout Contract ✅ Passed The new test file adds only Ginkgo It/BeforeEach logic; no main/init/TestMain/BeforeSuite stdout writes or direct fmt.Print/klog stdout usage were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new test only edits MachineConfig, checks node logs/events, and generates local SSH keys; it makes no external network calls or IPv4-only assumptions.
No-Weak-Crypto ✅ Passed No flagged weak crypto or secret comparisons were added; the test uses RSA-2048 and openssl passwd -6 (SHA-512 crypt), not MD5/SHA1/DES/RC4/etc.
Container-Privileges ✅ Passed Changed file is a Go e2e test only; patch search found no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The added test logs only status text and node names; it does not print passwords, hashes, keys, tokens, or other sensitive values.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the added test and its purpose: applying password changes only when the hash changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from proietfb and umohnani8 July 23, 2026 07:30
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/extended-priv/mco_password.go`:
- Around line 448-449: Remove node.GetName() and any other node-identifying
values from the assertion messages associated with IgnoreEventsBeforeNow and the
analogous checks at the referenced locations. Keep each failure message
descriptive without exposing hostnames or other internal node identifiers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c28a1c4-830c-4b67-afe3-2de8b29c5008

📥 Commits

Reviewing files that changed from the base of the PR and between 6197659 and 2ca5a9f.

📒 Files selected for processing (1)
  • test/extended-priv/mco_password.go

Comment thread test/extended-priv/mco_password.go
@ptalgulk01

Copy link
Copy Markdown
Contributor Author

/test security

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/extended-priv/mco_password.go`:
- Around line 462-467: Update the password-configuration verification around
mc.create() to capture the pwdConfiguredLogMsg count from
node.GetMCDaemonLogs("") before applying the MachineConfig, then retrieve the
logs afterward and assert the count increased. Replace the current
initialPasswordCount > 0 check while preserving the existing error handling and
node-specific assertion context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d493ad0d-e989-4019-ae1c-09cd39ebfc10

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca5a9f and bd1f966.

📒 Files selected for processing (1)
  • test/extended-priv/mco_password.go

Comment on lines +462 to +467
exutil.By("Check MCD logs to verify 'Password has been configured' is logged")
mcdLogs, err := node.GetMCDaemonLogs("")
o.Expect(err).NotTo(o.HaveOccurred(), "Error getting MCD logs for node %s", node.GetName())
initialPasswordCount := strings.Count(mcdLogs, pwdConfiguredLogMsg)
o.Expect(initialPasswordCount).To(o.BeNumerically(">", 0),
"Expected '%s' in MCD logs after initial password application on node %s", pwdConfiguredLogMsg, node.GetName())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Capture the pre-apply log count.

initialPasswordCount > 0 passes when the node already has this message from prior activity, so it does not prove the initial MachineConfig emitted it. Snapshot the count before mc.create() and compare against that baseline.

Proposed fix
+		mcdLogsBeforeApply, err := node.GetMCDaemonLogs("")
+		o.Expect(err).NotTo(o.HaveOccurred(), "Error getting MCD logs")
+		passwordCountBeforeApply := strings.Count(mcdLogsBeforeApply, pwdConfiguredLogMsg)
+
 		exutil.By("Apply MC with passwordHash for core user")
 ...
-		o.Expect(initialPasswordCount).To(o.BeNumerically(">", 0),
+		o.Expect(initialPasswordCount).To(o.BeNumerically(">", passwordCountBeforeApply),

Based on the PR objective to verify initial password-configuration logging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/extended-priv/mco_password.go` around lines 462 - 467, Update the
password-configuration verification around mc.create() to capture the
pwdConfiguredLogMsg count from node.GetMCDaemonLogs("") before applying the
MachineConfig, then retrieve the logs afterward and assert the count increased.
Replace the current initialPasswordCount > 0 check while preserving the existing
error handling and node-specific assertion context.

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@ptalgulk01: all tests passed!

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@sergiordlr

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the main branch

Use /test ? to see all available tests.

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ptalgulk01, sergiordlr

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:
  • OWNERS [ptalgulk01,sergiordlr]

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

@ptalgulk01

Copy link
Copy Markdown
Contributor Author

4.23:

5.0:

@ptalgulk01

Copy link
Copy Markdown
Contributor Author
  • OCP-88940 passed in every shard it was scheduled on (4/4 complete, 1 job still running)
  • All failures are pre-existing tests unrelated to this PR
    /verified by @ptalgulk01

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: This PR has been marked as verified by @ptalgulk01.

Details

In response to this:

  • OCP-88940 passed in every shard it was scheduled on (4/4 complete, 1 job still running)
  • All failures are pre-existing tests unrelated to this PR
    /verified by @ptalgulk01

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 openshift-eng/jira-lifecycle-plugin repository.

@ptalgulk01

Copy link
Copy Markdown
Contributor Author

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci Bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Jul 24, 2026
@ptalgulk01 ptalgulk01 changed the title Add TC 88940: Apply password only if changes exist OCPBUGS-83830: Add TC 88940- Apply password only if changes exist Jul 24, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: This pull request references Jira Issue OCPBUGS-83830, which is invalid:

  • expected the bug to be in one of the following states: NEW, ASSIGNED, POST, but it is Verified instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

  • What I did

Added e2e test OCP-88940 to verify that MCD applies password usermod only when the password hash actually changes (OCPBUGS-83830).

The test covers:

  1. Apply a MachineConfig with passwordHash for the core user → verify "Password has been configured" appears in MCD logs
  2. Update the passwordHash to a different value → verify "Password has been configured" appears again
  3. Add an SSH key without changing the password hash → verify "Password has been configured" does not appear (the key assertion for the bug fix)
  4. Verify no drain or reboot events are triggered throughout
  • How to verify it
 make machine-config-tests-ext
 ./_output/linux/amd64/machine-config-tests-ext list | grep 88940
  • Run on a cluster:
    ./_output/linux/amd64/machine-config-tests-ext run --test "PolarionID:88940"

  • Description for the changelog
    Add e2e test OCP-88940 validating MCD only runs password usermod when the hash changes, not on unrelated passwd section updates like SSH key additions.

Summary by CodeRabbit

  • Tests
  • Added a new disruptive long-duration test for applying password changes only when updates exist, confirming the expected Machine Config Daemon log output.
  • Verified that initial password-hash deployment skips drain/reboot, and that subsequent password-hash replacement increases the log occurrence count appropriately.
  • Ensured that updating the user configuration with an added SSH public key (while keeping the updated password hash) does not increase the password-configured log count and does not trigger drain or reboot.

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 openshift-eng/jira-lifecycle-plugin repository.

@ptalgulk01 ptalgulk01 changed the title OCPBUGS-83830: Add TC 88940- Apply password only if changes exist OCPBUGS-99695: Add TC 88940- Apply password only if changes exist Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: This pull request references Jira Issue OCPBUGS-99695, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

  • What I did

Added e2e test OCP-88940 to verify that MCD applies password usermod only when the password hash actually changes (OCPBUGS-83830).

The test covers:

  1. Apply a MachineConfig with passwordHash for the core user → verify "Password has been configured" appears in MCD logs
  2. Update the passwordHash to a different value → verify "Password has been configured" appears again
  3. Add an SSH key without changing the password hash → verify "Password has been configured" does not appear (the key assertion for the bug fix)
  4. Verify no drain or reboot events are triggered throughout
  • How to verify it
 make machine-config-tests-ext
 ./_output/linux/amd64/machine-config-tests-ext list | grep 88940
  • Run on a cluster:
    ./_output/linux/amd64/machine-config-tests-ext run --test "PolarionID:88940"

  • Description for the changelog
    Add e2e test OCP-88940 validating MCD only runs password usermod when the hash changes, not on unrelated passwd section updates like SSH key additions.

Summary by CodeRabbit

  • Tests
  • Added a new disruptive long-duration test for applying password changes only when updates exist, confirming the expected Machine Config Daemon log output.
  • Verified that initial password-hash deployment skips drain/reboot, and that subsequent password-hash replacement increases the log occurrence count appropriately.
  • Ensured that updating the user configuration with an added SSH public key (while keeping the updated password hash) does not increase the password-configured log count and does not trigger drain or reboot.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. label Jul 24, 2026
@ptalgulk01

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: This pull request references Jira Issue OCPBUGS-99695, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@ptalgulk01

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-4.22

@openshift-cherrypick-robot

Copy link
Copy Markdown

@ptalgulk01: once the present PR merges, I will cherry-pick it on top of release-4.22 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-4.22

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.

@ptalgulk01

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. label Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: This pull request references Jira Issue OCPBUGS-99695, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 77e6c6d into openshift:main Jul 24, 2026
9 checks passed
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ptalgulk01: Jira Issue Verification Checks: Jira Issue OCPBUGS-99695
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-99695 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

  • What I did

Added e2e test OCP-88940 to verify that MCD applies password usermod only when the password hash actually changes (OCPBUGS-83830).

The test covers:

  1. Apply a MachineConfig with passwordHash for the core user → verify "Password has been configured" appears in MCD logs
  2. Update the passwordHash to a different value → verify "Password has been configured" appears again
  3. Add an SSH key without changing the password hash → verify "Password has been configured" does not appear (the key assertion for the bug fix)
  4. Verify no drain or reboot events are triggered throughout
  • How to verify it
 make machine-config-tests-ext
 ./_output/linux/amd64/machine-config-tests-ext list | grep 88940
  • Run on a cluster:
    ./_output/linux/amd64/machine-config-tests-ext run --test "PolarionID:88940"

  • Description for the changelog
    Add e2e test OCP-88940 validating MCD only runs password usermod when the hash changes, not on unrelated passwd section updates like SSH key additions.

Summary by CodeRabbit

  • Tests
  • Added a new disruptive long-duration test for applying password changes only when updates exist, confirming the expected Machine Config Daemon log output.
  • Verified that initial password-hash deployment skips drain/reboot, and that subsequent password-hash replacement increases the log occurrence count appropriately.
  • Ensured that updating the user configuration with an added SSH public key (while keeping the updated password hash) does not increase the password-configured log count and does not trigger drain or reboot.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-cherrypick-robot

Copy link
Copy Markdown

@ptalgulk01: new pull request created: #6339

Details

In response to this:

/cherry-pick release-4.22

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.

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

Fix included in release 5.0.0-0.nightly-2026-07-25-032712

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

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants