Skip to content

Add RF cases for trust manager - #7129

Open
kasturinarra wants to merge 1 commit into
openshift:mainfrom
kasturinarra:trust-manager-tests
Open

Add RF cases for trust manager#7129
kasturinarra wants to merge 1 commit into
openshift:mainfrom
kasturinarra:trust-manager-tests

Conversation

@kasturinarra

@kasturinarra kasturinarra commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for distributing Pebble ACME root certificates through trust-manager bundles.
    • Confirmed bundled certificates are available as valid PEM data in target ConfigMaps.
    • Verified trust-manager bundles and certificate data persist across MicroShift restarts.
  • Tests
    • Added end-to-end coverage for certificate setup, synchronization, certificate retrieval, cleanup, and restart recovery.
    • Added validation that trust-manager resumes successfully after a MicroShift restart.

@openshift-ci
openshift-ci Bot requested review from eslutsky and pacevedom July 30, 2026 18:48
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kasturinarra

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 15b14a98-1136-433a-8361-e4c03d0b7768

📥 Commits

Reviewing files that changed from the base of the PR and between 9f21baa and 5e835e9.

📒 Files selected for processing (1)
  • test/suites/optional/cert-manager.robot
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/suites/optional/cert-manager.robot

Walkthrough

Adds Robot tests for Pebble ACME root CA distribution through trust-manager and for Bundle target persistence across a MicroShift restart.

Changes

Trust-manager integration tests

Layer / File(s) Summary
Cert-manager Bundle setup
test/suites/optional/cert-manager.robot
Adds shared setup for cert-manager CA resources and updates the existing Bundle test to use it with explicit cleanup.
Pebble CA distribution
test/suites/optional/cert-manager.robot
Retrieves and validates Pebble’s root CA, creates the source Secret and Bundle, verifies target ConfigMap data, and extends HTTP01 cleanup.
MicroShift restart persistence
test/suites/optional/cert-manager.robot
Records Bundle ConfigMap data, restarts MicroShift, waits for trust-manager recovery, and compares the data after synchronization.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RobotTest
  participant Pebble
  participant CertManager
  participant TrustManager
  participant TargetConfigMap
  participant MicroShift
  RobotTest->>Pebble: Retrieve and validate root CA
  RobotTest->>CertManager: Create issuer and CA resources
  RobotTest->>TrustManager: Create source Secret and Bundle
  TrustManager->>TargetConfigMap: Synchronize PEM data
  RobotTest->>TargetConfigMap: Verify Bundle output
  RobotTest->>MicroShift: Restart
  RobotTest->>TrustManager: Wait for recovery
  RobotTest->>TargetConfigMap: Compare persisted data
Loading

Suggested reviewers: pacevedom

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Robot Framework test cases for trust-manager functionality.
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 changed Robot test titles are static descriptive strings; the two new titles contain no variables, generated IDs, timestamps, node names, namespaces, or IP addresses.
Test Structure And Quality ✅ Passed The PR changes a Robot Framework suite (cert-manager.robot) with Robot test cases and [Setup]/[Teardown]; it contains no Ginkgo It blocks, so this Ginkgo-specific check is not applicable.
Microshift Test Compatibility ✅ Passed The PR changes a Robot Framework suite, not Ginkgo tests. The added tests use Kubernetes, cert-manager, and trust-manager resources and no forbidden MicroShift APIs or assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The commit changes only a Robot Framework suite and adds no Ginkgo tests; its tests use single-node MicroShift operations and make no multi-node or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only the Robot test file changed. The added tests and keywords introduce no affinity, topology spread, node selector, toleration, rollout, replica, or PDB scheduling constraints.
Ote Binary Stdout Contract ✅ Passed Only cert-manager.robot changed; added Process stdout references are captured in Robot keywords, with no Go main/init/suite stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds Robot Framework tests, not Ginkgo tests. Added networking uses cluster-local Pebble DNS and a port-forwarded localhost; no IPv4 literal or public endpoint is added.
No-Weak-Crypto ✅ Passed The commit adds certificate retrieval, storage, and status checks only; it introduces no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR changes only Robot tests. The referenced Pebble Deployment sets allowPrivilegeEscalation:false, runAsNonRoot:true, and drops ALL capabilities; no privileged, host namespace, or SYS_ADMIN set...
No-Sensitive-Data-In-Logs ✅ Passed New output paths expose only test-generated or public CA certificates and generic port-forward errors; no passwords, tokens, API keys, PII, customer data, or new sensitive hostname logging was found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/suites/optional/cert-manager.robot`:
- Around line 185-190: Update the assertion following the Oc Get JsonPath call
to verify that ${cm_data} contains ${pebble_ca}, replacing the generic BEGIN
CERTIFICATE check while preserving the existing failure message context.
- Around line 506-512: Replace the fixed Sleep delay in the Pebble root CA
retrieval flow with readiness polling that repeatedly runs curl and validates
both a successful return code and PEM content. Retry until the endpoint is
ready, then preserve the existing RETURN of ${result.stdout} and failure
diagnostics.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 51e94dec-a7bb-4655-a8a4-1dd7400736bf

📥 Commits

Reviewing files that changed from the base of the PR and between ea9ff1a and 2acf344.

📒 Files selected for processing (1)
  • test/suites/optional/cert-manager.robot

Comment thread test/suites/optional/cert-manager.robot Outdated
Comment thread test/suites/optional/cert-manager.robot Outdated
@kasturinarra
kasturinarra force-pushed the trust-manager-tests branch from 2acf344 to 6a3ddfd Compare July 30, 2026 19:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/suites/optional/cert-manager.robot (1)

477-489: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider reusing this keyword in the existing Trust Manager Bundle With Cert Manager CA test.

Setup Trust Bundle With Cert Manager CA duplicates the ClusterIssuer/CA-certificate/Bundle flow already inline at lines 133-143. Extracting it here is good, but the older test wasn't updated to call it, so the two copies can now drift.

♻️ Proposed consolidation
 Trust Manager Bundle With Cert Manager CA
     [Documentation]    Verify trust-manager Bundle can use a cert-manager CA secret as a source
     [Tags]    trust-manager
     [Setup]    Enable Trust Manager
 
-    Apply Template    ${CLUSTER_ISSUER_TMPL}
-    Oc Wait    -n ${NAMESPACE} clusterissuer ${ISSUER_NAME}
-    ...    --for="condition=Ready" --timeout=${DEFAULT_WAIT_TIMEOUT}
-
-    Apply Template    ${CA_CERTIFICATE_TMPL}
-    Oc Wait    -n ${TRUST_MANAGER_NS} certificate ca-certificate
-    ...    --for="condition=Ready" --timeout=${DEFAULT_WAIT_TIMEOUT}
-
-    Apply Template    ${TRUST_BUNDLE_SECRET_TMPL}
-    Oc Wait    bundle ${TRUST_MANAGER_BUNDLE_NAME}
-    ...    --for=jsonpath='{.status.conditions[?(@.type=="Synced")].status}'=True --timeout=${DEFAULT_WAIT_TIMEOUT}
+    Setup Trust Bundle With Cert Manager CA
🤖 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/suites/optional/cert-manager.robot` around lines 477 - 489, Update the
existing “Trust Manager Bundle With Cert Manager CA” test to call the shared
“Setup Trust Bundle With Cert Manager CA” keyword instead of duplicating the
ClusterIssuer, CA-certificate, and Bundle setup steps. Remove the inline setup
sequence while preserving the test’s remaining behavior.
🤖 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/suites/optional/cert-manager.robot`:
- Around line 499-521: Update Fetch Pebble Root CA and Pebble Root CA Should Be
Available so the readiness keyword returns the already-validated curl output,
then have Fetch Pebble Root CA return that value after Wait Until Keyword
Succeeds. Remove the redundant post-poll Process.Run Process curl and preserve
the existing rc and certificate-content checks.

---

Nitpick comments:
In `@test/suites/optional/cert-manager.robot`:
- Around line 477-489: Update the existing “Trust Manager Bundle With Cert
Manager CA” test to call the shared “Setup Trust Bundle With Cert Manager CA”
keyword instead of duplicating the ClusterIssuer, CA-certificate, and Bundle
setup steps. Remove the inline setup sequence while preserving the test’s
remaining behavior.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: afd7ef52-7ce0-4bbe-b7f7-45d02710379e

📥 Commits

Reviewing files that changed from the base of the PR and between 2acf344 and 6a3ddfd.

📒 Files selected for processing (1)
  • test/suites/optional/cert-manager.robot

Comment thread test/suites/optional/cert-manager.robot
@kasturinarra
kasturinarra force-pushed the trust-manager-tests branch from 6a3ddfd to 6ce78e0 Compare July 31, 2026 06:24
@kasturinarra

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-tests-bootc-el9

[Documentation] Fetch the root CA certificate from Pebble management API via port-forward
[Arguments] ${namespace}
${port_fwd}= Process.Start Process
... oc port-forward deployment/pebble 15000:15000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fetch Pebble Root CA starts oc port-forward asynchronously but never checks if it actually started

Comment thread test/suites/optional/cert-manager.robot Outdated

Pebble Root CA Should Be Available
[Documentation] Check that the Pebble management API returns a valid CA certificate
${result}= Process.Run Process curl -sk https://localhost:15000/roots/0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

curl does not use --fail — curl returns rc=0 even on HTTP 4xx/5xx responses. If Pebble returns an error page, the rc check passes and the response body (potentially invalid) gets stored as the CA certificate. Fix: Add --fail to the curl flags so HTTP errors produce a non-zero exit code.

[Teardown] Run Keywords
... Cleanup Trust Bundle
... AND Oc Delete secret ca-source-secret -n ${TRUST_MANAGER_NS} --ignore-not-found
... AND Cleanup HTTP01 Resources

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cleanup HTTP01 Resources deletes the Pebble deployment and service but not the pebble ConfigMap created by pebble-server.yaml. Pre-existing issue, but both new tests inherit it.
Fix: Add Oc Delete configmap/pebble -n ${NAMESPACE} --ignore-not-found.

@kasturinarra
kasturinarra force-pushed the trust-manager-tests branch from 6ce78e0 to 9f21baa Compare July 31, 2026 11:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/suites/optional/cert-manager.robot (1)

479-489: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse the new helper in the existing test to remove duplication.

Setup Trust Bundle With Cert Manager CA duplicates the Apply Template / Oc Wait sequence already present in the pre-existing test Trust Manager Bundle With Cert Manager CA (lines 133-143). Call the new keyword from that test body instead of keeping two copies of the same sequence. Two copies increase the risk that future changes to one location miss the other.

Apply this change at lines 133-143 (outside the segment shown here):

Trust Manager Bundle With Cert Manager CA
    [Documentation]    Verify trust-manager Bundle can use a cert-manager CA secret as a source
    [Tags]    trust-manager
    [Setup]    Enable Trust Manager

    Setup Trust Bundle With Cert Manager CA

    ${cm_data}=    Oc Get JsonPath
    ...    configmap
    ...    ${NAMESPACE}
    ...    ${TRUST_MANAGER_BUNDLE_NAME}
    ...    .data.ca-bundle\\.crt
    Should Contain    ${cm_data}    BEGIN CERTIFICATE    msg=ConfigMap does not contain CA certificate data
🤖 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/suites/optional/cert-manager.robot` around lines 479 - 489, Update the
existing Trust Manager Bundle With Cert Manager CA test to call Setup Trust
Bundle With Cert Manager CA for the shared setup sequence, removing the
duplicated Apply Template and Oc Wait steps while preserving the subsequent
certificate-data assertions.
🤖 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.

Nitpick comments:
In `@test/suites/optional/cert-manager.robot`:
- Around line 479-489: Update the existing Trust Manager Bundle With Cert
Manager CA test to call Setup Trust Bundle With Cert Manager CA for the shared
setup sequence, removing the duplicated Apply Template and Oc Wait steps while
preserving the subsequent certificate-data assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 5e88c314-01d1-4e93-bffc-a28271b2d7a7

📥 Commits

Reviewing files that changed from the base of the PR and between 6ce78e0 and 9f21baa.

📒 Files selected for processing (1)
  • test/suites/optional/cert-manager.robot

@kasturinarra
kasturinarra force-pushed the trust-manager-tests branch from 9f21baa to 5e835e9 Compare July 31, 2026 11:41
@eslutsky

Copy link
Copy Markdown
Contributor

/test release-5.0-periodics-e2e-aws-tests-nightly

@eslutsky

Copy link
Copy Markdown
Contributor

/test e2e-aws-tests-periodic

@kasturinarra

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-tests

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@kasturinarra: 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants