Skip to content

fix(e2e): add SinceSeconds support to pod log helpers#2515

Merged
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:fix-e2e-logs-absence
Feb 27, 2026
Merged

fix(e2e): add SinceSeconds support to pod log helpers#2515
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:fix-e2e-logs-absence

Conversation

@zakisk
Copy link
Member

@zakisk zakisk commented Feb 27, 2026

The GetPodLog, GetControllerLogByName, RegexpMatchingInControllerLog, RegexpMatchingInPodLog, and GoldenPodLog functions now accept an optional sinceSeconds parameter, which maps to the Kubernetes PodLogOptions.SinceSeconds field.

When kubelet rotates CRI container logs (e.g. containerd splitting 0.log into 0.log. and a new 0.log), the TailLines option may only read from the current log file, causing regexp assertions to miss matching lines that landed in the rotated segment. This was observed in TestGithubGHEPullRequestGitCloneTask where the "fetched git-clone task" message was written at 06:30:09, CRI rotation occurred at 06:30:13, and the test checked at 06:30:21 finding only 2 lines in the new 0.log.

SinceSeconds uses timestamps rather than byte offsets, so it reads across rotated CRI log files reliably. Callers that do not need time-based filtering pass nil to preserve existing behaviour.

Assisted-by: Claude Opus 4.6 (via Claude Code)

📝 Description of the Change

👨🏻‍ Linked Jira

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

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

🤖 AI Assistance

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

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

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: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ 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

@pipelines-as-code
Copy link

pipelines-as-code bot commented Feb 27, 2026

🔍 PR Lint Feedback

Note: This automated check helps ensure your PR follows our contribution guidelines.

⚠️ Items that need attention:

🎫 Jira reference

Add a Jira reference in the description using one of the following formats:

  • https://issues.redhat.com/browse/SRVKP-<number>

If no SRVKP ticket exists yet, link a GitHub issue instead (e.g., Fixes #123).
Minor housekeeping PRs without Jira coverage can skip this after confirming with reviewers.


ℹ️ Next Steps

  • Review and address the items above
  • Push new commits to update this PR
  • This comment will be automatically updated when issues are resolved
🔧 Admin Tools (click to expand)

Automated Issue/Ticket Creation:

  • /issue-create - Generate a GitHub issue from this PR content using AI
  • /jira-create - Create a SRVKP Jira ticket from this PR content using AI

⚠️ Important: Always review and edit generated content before finalizing tickets/issues.
The AI-generated content should be used as a starting point and may need adjustments.

These commands are available to maintainers and will post the generated content as PR comments for review.

🤖 This feedback was generated automatically by the PR CI system

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant improvement to log retrieval mechanisms within the testing framework by adding support for the sinceSeconds parameter. This change directly tackles the challenge of log rotation in container runtimes, which previously led to incomplete log captures and flakiness in tests relying on log content. By enabling time-based log fetching, the system can now reliably access logs across rotated files, ensuring more accurate and robust test assertions.

Highlights

  • Enhanced Log Retrieval with SinceSeconds: The GetPodLog, GetControllerLogByName, RegexpMatchingInControllerLog, RegexpMatchingInPodLog, and GoldenPodLog helper functions now support an optional sinceSeconds parameter. This parameter maps directly to Kubernetes PodLogOptions.SinceSeconds.
  • Improved Reliability for Log Matching: This enhancement addresses issues with CRI container log rotation, where TailLines might miss matching lines in rotated log segments. By using SinceSeconds, log retrieval is more reliable as it uses timestamps and reads across rotated log files.
  • Backward Compatibility Maintained: Existing callers that do not require time-based filtering can pass nil for the sinceSeconds parameter, ensuring no breaking changes to current test implementations.
Changelog
  • test/bitbucket_datacenter_dynamic_variables_test.go
    • Updated RegexpMatchingInPodLog call to include the new sinceSeconds parameter as nil.
  • test/gitea_access_control_test.go
    • Updated RegexpMatchingInPodLog call to include the new sinceSeconds parameter as nil.
  • test/gitea_custom_params_cel_test.go
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
    • Updated RegexpMatchingInControllerLog call to include the new sinceSeconds parameter as nil.
  • test/gitea_gitops_commands_test.go
    • Updated GoldenPodLog calls to include the new sinceSeconds parameter as nil.
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
  • test/gitea_params_test.go
    • Updated GetPodLog calls to include the new sinceSeconds parameter as nil.
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
  • test/gitea_test.go
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
    • Updated RegexpMatchingInControllerLog calls to include the new sinceSeconds parameter as nil.
  • test/github_incoming_test.go
    • Updated RegexpMatchingInPodLog call to include the new sinceSeconds parameter as nil.
  • test/github_pullrequest_privaterepository_test.go
    • Modified RegexpMatchingInControllerLog call to explicitly use a sinceSeconds value of 20 seconds instead of maxLines.
  • test/github_pullrequest_test.go
    • Updated RegexpMatchingInControllerLog calls to include the new sinceSeconds parameter as nil.
    • Updated GoldenPodLog call to include the new sinceSeconds parameter as nil.
  • test/github_pullrequest_test_comment_test.go
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
  • test/github_push_retest_test.go
    • Updated RegexpMatchingInPodLog call to include the new sinceSeconds parameter as nil.
    • Updated RegexpMatchingInControllerLog call to include the new sinceSeconds parameter as nil.
  • test/github_skip_ci_test.go
    • Updated RegexpMatchingInControllerLog calls to include the new sinceSeconds parameter as nil.
  • test/gitlab_delete_tag_event_test.go
    • Updated RegexpMatchingInControllerLog call to include the new sinceSeconds parameter as nil.
  • test/gitlab_merge_request_test.go
    • Updated RegexpMatchingInPodLog calls to include the new sinceSeconds parameter as nil.
  • test/pkg/gitea/test.go
    • Updated GetPodLog call to include the new sinceSeconds parameter as nil.
  • test/pkg/github/instrumentation.go
    • Updated GetControllerLogByName call to include the new sinceSeconds parameter as nil.
  • test/pkg/podlogs/pod.go
    • Updated GetControllerLog function signature to accept an optional sinceSeconds parameter.
    • Updated GetControllerLog to pass the sinceSeconds parameter to GetPodLog.
    • Updated GetControllerLogByName function signature to accept an optional sinceSeconds parameter.
    • Updated GetControllerLogByName to pass the sinceSeconds parameter to GetPodLog.
    • Updated GetPodLog function signature to accept an optional sinceSeconds parameter.
    • Implemented conditional setting of PodLogOptions.SinceSeconds based on the provided sinceSeconds parameter.
  • test/pkg/wait/logs.go
    • Updated RegexpMatchingInControllerLog function signature to accept an optional sinceSeconds parameter.
    • Updated RegexpMatchingInControllerLog to pass the sinceSeconds parameter to tlogs.GetControllerLogByName.
    • Updated RegexpMatchingInPodLog function signature to accept an optional sinceSeconds parameter.
    • Updated RegexpMatchingInPodLog to pass the sinceSeconds parameter to tlogs.GetPodLog.
    • Updated GoldenPodLog function signature to accept an optional sinceSeconds parameter.
    • Updated GoldenPodLog to pass the sinceSeconds parameter to tlogs.GetPodLog.
Activity
  • The pull request author, zakisk, utilized Claude Opus 4.6 (via Claude Code) for assistance with documentation, research, code generation for parts of the code, and crafting the PR description and commit messages.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

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 introduces support for SinceSeconds in pod log helper functions to address issues with log rotation in E2E tests. The changes are well-implemented, adding a sinceSeconds parameter to relevant functions and updating call sites. The core logic correctly constructs PodLogOptions based on the new parameter. The one test that was failing due to log rotation is updated to use sinceSeconds, while other tests are updated to pass nil, preserving their existing behavior. The changes are clean and effectively solve the described problem.

@zakisk
Copy link
Member Author

zakisk commented Feb 27, 2026

/retest

Copy link
Member

@theakshaypant theakshaypant left a comment

Choose a reason for hiding this comment

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

Overall like the idea. Got a couple comments:

  1. Nit: Recommend changing the commit to test(e2e): add SinceSeconds support to pod log helpers]
  2. I see sinceSeconds being set to nil for all tests, what is the plan to actually use it?

@zakisk
Copy link
Member Author

zakisk commented Feb 27, 2026

I see sinceSeconds being set to nil for all tests, what is the plan to actually use it?

at the moment sinceSeconds is used only for TestGithubGHEPullRequestGitCloneTask which was failed for last two days in nightly. if this resolves the issue thoroughly we will consider it for others as well

@zakisk
Copy link
Member Author

zakisk commented Feb 27, 2026

Nit: Recommend changing the commit to test(e2e): add SinceSeconds support to pod log helpers]

I would rather prefer fix(e2e) because it fixes test issues and I think test: is used when you're adding tests 🤷🏻

@theakshaypant
Copy link
Member

Nit: Recommend changing the commit to test(e2e): add SinceSeconds support to pod log helpers]

I would rather prefer fix(e2e) because it fixes test issues and I think test: is used when you're adding tests 🤷🏻

Fairs! That's why had added it as a nit, I personally prefer, all test related changes as test: 😅

The GetPodLog, GetControllerLogByName, RegexpMatchingInControllerLog,
RegexpMatchingInPodLog, and GoldenPodLog functions now accept an
optional sinceSeconds parameter, which maps to the Kubernetes
PodLogOptions.SinceSeconds field.

When kubelet rotates CRI container logs (e.g. containerd splitting
0.log into 0.log.<timestamp> and a new 0.log), the TailLines option
may only read from the current log file, causing regexp assertions
to miss matching lines that landed in the rotated segment. This was
observed in TestGithubGHEPullRequestGitCloneTask where the
"fetched git-clone task" message was written at 06:30:09, CRI
rotation occurred at 06:30:13, and the test checked at 06:30:21
finding only 2 lines in the new 0.log.

SinceSeconds uses timestamps rather than byte offsets, so it reads
across rotated CRI log files reliably. Callers that do not need
time-based filtering pass nil to preserve existing behaviour.

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
Assisted-by: Claude Opus 4.6 (via Claude Code)
@zakisk zakisk force-pushed the fix-e2e-logs-absence branch from 04bb80b to 4fec6d0 Compare February 27, 2026 12:53
@zakisk
Copy link
Member Author

zakisk commented Feb 27, 2026

Fairs! That's why had added it as a nit, I personally prefer, all test related changes as test: 😅

everyone has his/her own interpretation 😄

@chmouel chmouel merged commit 70d1ff1 into tektoncd:main Feb 27, 2026
18 of 19 checks passed
@zakisk zakisk deleted the fix-e2e-logs-absence branch February 27, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants