Skip to content

fix: fix dex e2e test failures#1165

Open
Rizwana777 wants to merge 1 commit into
redhat-developer:masterfrom
Rizwana777:fix-dex-e2e-failures
Open

fix: fix dex e2e test failures#1165
Rizwana777 wants to merge 1 commit into
redhat-developer:masterfrom
Rizwana777:fix-dex-e2e-failures

Conversation

@Rizwana777
Copy link
Copy Markdown
Collaborator

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind bug
/kind cleanup
/kind failing-test
/kind enhancement
/kind documentation
/kind code-refactoring

What does this PR do / why we need it:

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?

Test acceptance criteria:

  • Unit Test
  • E2E Test

How to test changes / Special notes to the reviewer:

@openshift-ci openshift-ci Bot requested a review from AdamSaleh June 4, 2026 07:49
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 4, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 requested a review from svghadi June 4, 2026 07:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 27b42c19-53cf-4eb3-a748-861b308bb8bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9649256 and 64672ad.

📒 Files selected for processing (3)
  • test/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go
  • test/openshift/e2e/ginkgo/parallel/1-095_validate_dex_clientsecret_test.go
  • test/openshift/e2e/ginkgo/parallel/1-098_validate_dex_clientsecret_deprecated.go
✅ Files skipped from review due to trivial changes (1)
  • test/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/openshift/e2e/ginkgo/parallel/1-095_validate_dex_clientsecret_test.go
  • test/openshift/e2e/ginkgo/parallel/1-098_validate_dex_clientsecret_deprecated.go

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Updated Redis toolchain validation to expect version 8.2.3 in released environments.
    • Improved Dex client-secret validation: tests now wait for a deterministic token secret, verify it includes an expiry, and confirm the token matches the stored OIDC client secret.

Walkthrough

Three E2E tests updated: two Dex client-secret tests now fetch a deterministic Dex token Secret and validate its token and expiry fields before comparing to argocd-secret, and the toolchain test updates the expected Redis version from 7.2.11 to 8.2.3.

Changes

Dex Token Secret Validation Pattern

Layer / File(s) Summary
Active Dex client secret validation
test/openshift/e2e/ginkgo/parallel/1-095_validate_dex_clientsecret_test.go
Removes strings import and replaces secret validation: compute deterministic secret name (<argocd>-<dex-sa>-token), wait for that Secret, assert token and expiry fields exist, and validate token equals argocd-secret's oidc.dex.clientSecret.
Deprecated Dex client secret validation
test/openshift/e2e/ginkgo/parallel/1-098_validate_dex_clientsecret_deprecated.go
Applies same deterministic-token pattern: remove scanning of ServiceAccount referenced secrets, fetch deterministic Dex token Secret by name, assert token and expiry in secret.Data, and compare token to argocd-secret.

Toolchain Version Update

Layer / File(s) Summary
Redis version update
test/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go
Expected Redis version for non-prow (RC/released) environments updated from 7.2.11 to 8.2.3.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is a mostly empty PR template with unchecked boxes and blank sections, failing to provide meaningful information about the changes or intent. Provide a clear description of what the PR does, why the Dex tests were failing, how the changes fix them, and what changed files address.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: fixing Dex E2E test failures. It is concise and clearly summarizes the primary objective of the PR.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go (1)

95-104: ⚡ Quick win

Simplify version assignment to eliminate duplication.

Both the prow and non-prow branches now set expected_redisVersion to "8.2.3". Since the values are identical, consider extracting this to a single assignment outside the conditional block to improve maintainability.

♻️ Proposed refactor to eliminate duplication
 		var expected_dexVersion string
 		var expected_redisVersion string
+		expected_redisVersion = "8.2.3"
 
 		if os.Getenv("CI") == "prow" {
 			// when running against openshift-ci
 			expected_dexVersion = "v2.45.0"
-			expected_redisVersion = "8.2.3"
 
 		} else {
 			// when running against RC/ released version of gitops
 			expected_dexVersion = "v2.45.0"
-			expected_redisVersion = "8.2.3"
 		}
🤖 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/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go` around
lines 95 - 104, Both branches of the CI check set identical values
(expected_dexVersion and expected_redisVersion), so remove duplication by
assigning the common value(s) before the conditional; for example, set
expected_redisVersion = "8.2.3" (and expected_dexVersion = "v2.45.0" if both
always match) above the if that checks os.Getenv("CI") == "prow", then only keep
branch-specific overrides (if any) inside the if/else so functions/variables
named expected_dexVersion and expected_redisVersion are initialized once and the
conditional only contains unique logic.
🤖 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/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go`:
- Line 103: The test currently fails to find a Redis pod before running the
version check; update the verification to discover the actual Redis pod using
the same selector/pod-name resolution logic used elsewhere in the test (e.g.,
look for pods with label app.kubernetes.io/name=redis or any pod name containing
"redis" in the openshift-gitops namespace), then exec into that pod and run
`redis-server -v`; parse the output to extract the v=X.Y.Z token and assert it
equals the expected_redisVersion ("8.2.3") and that the full output matches the
expected "Redis server v=X.X.X sha=..." format used by the parsing code around
lines 167-173 so the check reliably targets the real Redis container before
parsing.

---

Nitpick comments:
In `@test/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go`:
- Around line 95-104: Both branches of the CI check set identical values
(expected_dexVersion and expected_redisVersion), so remove duplication by
assigning the common value(s) before the conditional; for example, set
expected_redisVersion = "8.2.3" (and expected_dexVersion = "v2.45.0" if both
always match) above the if that checks os.Getenv("CI") == "prow", then only keep
branch-specific overrides (if any) inside the if/else so functions/variables
named expected_dexVersion and expected_redisVersion are initialized once and the
conditional only contains unique logic.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 923832f2-925c-477d-95a5-fa8d4e1a433b

📥 Commits

Reviewing files that changed from the base of the PR and between 80dc7a8 and 9649256.

📒 Files selected for processing (3)
  • test/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go
  • test/openshift/e2e/ginkgo/parallel/1-095_validate_dex_clientsecret_test.go
  • test/openshift/e2e/ginkgo/parallel/1-098_validate_dex_clientsecret_deprecated.go

// when running against RC/ released version of gitops
expected_dexVersion = "v2.45.0"
expected_redisVersion = "7.2.11"
expected_redisVersion = "8.2.3"
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Jun 4, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify actual Redis version and output format in openshift-gitops namespace

# Wait for Redis pod to be ready
echo "Waiting for Redis pod..."
redis_pod=$(oc get pods -n openshift-gitops -l app.kubernetes.io/name=redis -o jsonpath='{.items[0].metadata.name}' 2>/dev/null)

if [ -z "$redis_pod" ]; then
  echo "ERROR: No Redis pod found in openshift-gitops namespace"
  exit 1
fi

echo "Found Redis pod: $redis_pod"

# Get Redis version
echo "Extracting Redis version..."
version_output=$(oc exec -n openshift-gitops "$redis_pod" -- redis-server -v 2>/dev/null)
echo "Raw output: $version_output"

# Check if output matches expected format
if echo "$version_output" | grep -q "v="; then
  version=$(echo "$version_output" | sed 's/.*v=\([^ ]*\).*/\1/')
  echo "Parsed version: $version"
  echo "Expected version: 8.2.3"
  if [ "$version" = "8.2.3" ]; then
    echo "✓ Version matches expectation"
  else
    echo "✗ Version mismatch: got $version, expected 8.2.3"
  fi
else
  echo "✗ Output format does not contain 'v=' pattern"
  echo "This may break the version parsing logic"
fi

Repository: redhat-developer/gitops-operator

Length of output: 157


Fix Redis-version verification to locate the actual Redis pod before checking output format.

The suggested verification script doesn’t find any Redis pod in the openshift-gitops namespace with -l app.kubernetes.io/name=redis (“No Redis pod found…”). Update the script to discover the Redis pod using the same selector/pod name logic the test uses (or dynamically search pod names for “redis” in the relevant namespace(s)), then run redis-server -v and ensure the parsed v=X.Y.Z matches 8.2.3 and conforms to the expected Redis server v=X.X.X sha=... format used by the parsing logic (around lines 167-173).

🤖 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/openshift/e2e/ginkgo/parallel/1-031_validate_toolchain_test.go` at line
103, The test currently fails to find a Redis pod before running the version
check; update the verification to discover the actual Redis pod using the same
selector/pod-name resolution logic used elsewhere in the test (e.g., look for
pods with label app.kubernetes.io/name=redis or any pod name containing "redis"
in the openshift-gitops namespace), then exec into that pod and run
`redis-server -v`; parse the output to extract the v=X.Y.Z token and assert it
equals the expected_redisVersion ("8.2.3") and that the full output matches the
expected "Redis server v=X.X.X sha=..." format used by the parsing code around
lines 167-173 so the check reliably targets the real Redis container before
parsing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might not require this change. Please revert if the tests fail.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@svghadi, understood. The change aligns both the prow and non-prow paths to 8.2.3, so monitoring the test results will be the clearest signal. If the deployed Redis image reports a different version string, reverting this line should be straightforward. Feel free to ping me if you'd like help investigating a failure.

Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
@Rizwana777 Rizwana777 force-pushed the fix-dex-e2e-failures branch from 9649256 to 64672ad Compare June 4, 2026 08:50
@Rizwana777
Copy link
Copy Markdown
Collaborator Author

/retest

@Rizwana777
Copy link
Copy Markdown
Collaborator Author

/test v4.19-kuttl-sequential

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.

2 participants