Skip to content

refactor(e2e): remove reliance on Repository.Status in wait functions#2789

Open
zakisk wants to merge 1 commit into
tektoncd:mainfrom
zakisk:SRVKP-12156-remove-repo-status-update-in-e2e
Open

refactor(e2e): remove reliance on Repository.Status in wait functions#2789
zakisk wants to merge 1 commit into
tektoncd:mainfrom
zakisk:SRVKP-12156-remove-repo-status-update-in-e2e

Conversation

@zakisk

@zakisk zakisk commented Jun 18, 2026

Copy link
Copy Markdown
Member

📝 Description of the Change

The Repository CR's Status field is deprecated and will be removed. This refactors E2E test wait helpers to use PipelineRun objects directly instead of polling Repository.Status:

  • Remove UntilRepositoryUpdated and UntilRepositoryHasStatusReason
  • Remove FailOnRepoCondition from wait.Opts
  • Modify UntilPipelineRunCreated and UntilPipelineRunHasReason to return []PipelineRun so callers can inspect annotations and conditions
  • Add UntilPipelineRunsFinished for mixed-outcome tests (1 pass + 1 fail)
  • Rewrite Succeeded() helper to validate PipelineRun annotations instead of repo.Status fields
  • Migrate all ~40 call sites across 20 test files

🔗 Linked GitHub Issue

Fixes #

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation,
documentation, or testing.

Please indicate whether you have used AI assistance
for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request refactors the end-to-end tests to monitor and assert on Tekton PipelineRuns directly rather than waiting for Repository status updates. The feedback highlights a recurring issue across multiple test files where the code directly accesses the Conditions slice by index (e.g., Conditions[0]) on a PipelineRun status. Since the order of conditions is not guaranteed, it is highly recommended to use GetCondition(apis.ConditionSucceeded) to safely and reliably retrieve the 'Succeeded' condition.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/pkg/wait/wait.go
Comment on lines +104 to 108
for _, pr := range prs.Items {
if len(pr.Status.Conditions) > 0 && pr.Status.Conditions[0].Status != corev1.ConditionUnknown {
finished = append(finished, pr)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

Suggested change
for _, pr := range prs.Items {
if len(pr.Status.Conditions) > 0 && pr.Status.Conditions[0].Status != corev1.ConditionUnknown {
finished = append(finished, pr)
}
}
for _, pr := range prs.Items {
if cond := pr.Status.GetCondition(apis.ConditionSucceeded); cond != nil && cond.Status != corev1.ConditionUnknown {
finished = append(finished, pr)
}
}
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

Comment on lines +56 to +57
g.Cnx.Clients.Log.Infof("Check if pipelinerun status shows succeeded")
assert.Equal(t, corev1.ConditionTrue, prs[len(prs)-1].Status.Conditions[0].Status)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

Suggested change
g.Cnx.Clients.Log.Infof("Check if pipelinerun status shows succeeded")
assert.Equal(t, corev1.ConditionTrue, prs[len(prs)-1].Status.Conditions[0].Status)
g.Cnx.Clients.Log.Infof("Check if pipelinerun status shows succeeded")
cond := prs[len(prs)-1].Status.GetCondition(apis.ConditionSucceeded)
assert.Assert(t, cond != nil)
assert.Equal(t, corev1.ConditionTrue, cond.Status)
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

Comment on lines +48 to +49
g.Cnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
assert.Assert(t, prs[len(prs)-1].Status.Conditions[0].Status == corev1.ConditionTrue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

	g.Cnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
	cond := prs[len(prs)-1].Status.GetCondition(apis.ConditionSucceeded)
	assert.Assert(t, cond != nil)
	assert.Equal(t, corev1.ConditionTrue, cond.Status)
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

Comment on lines +86 to +88
g.Cnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
assert.Equal(t, lastPR.Status.Conditions[0].Status, corev1.ConditionTrue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

Suggested change
g.Cnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
assert.Equal(t, lastPR.Status.Conditions[0].Status, corev1.ConditionTrue)
g.Cnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
cond := lastPR.Status.GetCondition(apis.ConditionSucceeded)
assert.Assert(t, cond != nil)
assert.Equal(t, corev1.ConditionTrue, cond.Status)
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

Comment on lines +182 to +184
topts.ParamsRun.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
assert.Assert(t, lastPR.Status.Conditions[0].Status == corev1.ConditionTrue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

Suggested change
topts.ParamsRun.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
assert.Assert(t, lastPR.Status.Conditions[0].Status == corev1.ConditionTrue)
topts.ParamsRun.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
lastPR := prs[len(prs)-1]
cond := lastPR.Status.GetCondition(apis.ConditionSucceeded)
assert.Assert(t, cond != nil)
assert.Equal(t, corev1.ConditionTrue, cond.Status)
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

Comment thread test/pkg/wait/check.go
Comment on lines +69 to +70
runcnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
assert.Equal(t, corev1.ConditionTrue, pr.Status.Conditions[0].Status)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Directly accessing the Conditions slice by index (e.g., Conditions[0]) is unreliable because the order of conditions is not guaranteed. Instead, use GetCondition(apis.ConditionSucceeded) to retrieve the 'Succeeded' condition safely.

	runcnx.Clients.Log.Infof("Check if we have the pipelinerun set as succeeded")
	cond := pr.Status.GetCondition(apis.ConditionSucceeded)
	assert.Assert(t, cond != nil)
	assert.Equal(t, corev1.ConditionTrue, cond.Status)
References
  1. When checking a Tekton PipelineRun's status, use GetCondition(apis.ConditionSucceeded) to reliably retrieve the 'Succeeded' condition, rather than accessing the Conditions slice by index (e.g., Conditions[0]).

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.73%. Comparing base (1c0fabc) to head (b51d85b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2789   +/-   ##
=======================================
  Coverage   59.73%   59.73%           
=======================================
  Files         210      210           
  Lines       21117    21117           
=======================================
  Hits        12615    12615           
  Misses       7707     7707           
  Partials      795      795           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zakisk zakisk force-pushed the SRVKP-12156-remove-repo-status-update-in-e2e branch 2 times, most recently from b51d85b to c211bca Compare June 20, 2026 11:04
The Repository CR's Status field is deprecated and will be removed.
This refactors E2E test wait helpers to use PipelineRun objects directly
instead of polling Repository.Status:

- Remove UntilRepositoryUpdated and UntilRepositoryHasStatusReason
- Remove FailOnRepoCondition from wait.Opts
- Modify UntilPipelineRunCreated and UntilPipelineRunHasReason to return
  []PipelineRun so callers can inspect annotations and conditions
- Add UntilPipelineRunsFinished for mixed-outcome tests (1 pass + 1 fail)
- Rewrite Succeeded() helper to validate PipelineRun annotations instead
  of repo.Status fields
- Migrate all ~40 call sites across 20 test files

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zakisk zakisk force-pushed the SRVKP-12156-remove-repo-status-update-in-e2e branch from c211bca to 51f1574 Compare June 21, 2026 11:29
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.

1 participant