Skip to content

RHIDP-14000: update feedback unit and e2e tests#1875

Merged
tisnik merged 4 commits into
lightspeed-core:mainfrom
Jdubrick:update-feedback-tests
Jun 9, 2026
Merged

RHIDP-14000: update feedback unit and e2e tests#1875
tisnik merged 4 commits into
lightspeed-core:mainfrom
Jdubrick:update-feedback-tests

Conversation

@Jdubrick

@Jdubrick Jdubrick commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

  • Add unit test for full config-to-exception chain when feedback is disabled
  • Add unit test for real filesystem I/O in store_feedback via tmp_path
  • Add concurrency smoke test for update_feedback_status under threaded access
  • Add e2e scenario for sequential feedback status toggling consistency
  • Add e2e scenario for duplicate feedback submission
  • Fix missing mock_authorization_resolvers calls in two existing status update tests

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: Claude
  • Generated by: Claude

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • Tests
    • Enhanced end-to-end test coverage for feedback functionality, including status toggle consistency and duplicate submission handling.
    • Expanded unit test coverage for feedback endpoints with configuration validation and concurrent access scenarios.

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@Jdubrick

Jdubrick commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Jdubrick, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 20 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6b5cf847-8765-488d-866f-74d3fc20f376

📥 Commits

Reviewing files that changed from the base of the PR and between d9c416e and 9320871.

📒 Files selected for processing (1)
  • tests/unit/app/endpoints/test_feedback.py

Walkthrough

This PR extends test coverage for the feedback feature by adding two end-to-end scenarios and four new unit tests. The E2E scenarios verify feedback status toggling consistency and duplicate submission handling. The unit tests validate configuration chains, filesystem storage, and concurrent operations.

Changes

Feedback Test Coverage

Layer / File(s) Summary
E2E feedback feature scenarios
tests/e2e/features/feedback.feature
Repairs the prior scenario block closure and adds two new scenarios: one verifying sequential feedback-enabled toggling and re-fetching, another verifying duplicate feedback submissions return consistent "feedback received" responses.
Unit test imports and config chain validation
tests/unit/app/endpoints/test_feedback.py
Adds asyncio, json, threading, and Path imports, plus a new test that exercises the complete configuration-to-exception flow for disabled feedback using a real UserDataCollection rather than mocks.
Filesystem storage persistence test
tests/unit/app/endpoints/test_feedback.py
Tests writing feedback to a real temporary filesystem, validating that a UUID-named JSON file is created with expected persisted fields including timestamp.
Concurrent operations and authorization test fixes
tests/unit/app/endpoints/test_feedback.py
Adds concurrent thread test for feedback status updates to verify thread safety, and ensures authorization resolvers are properly initialized in existing test.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding unit and e2e tests for feedback functionality, directly matching the file modifications in the changeset.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

@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 `@tests/unit/app/endpoints/test_feedback.py`:
- Around line 305-317: The tests mutate the process-wide
configuration.user_data_collection_configuration (used around store_feedback in
the test_feedback cases) and never restore it, causing flaky inter-test
interference; save a copy of the original
configuration.user_data_collection_configuration before mutating it (e.g., orig
= deepcopy(configuration.user_data_collection_configuration)), perform the test
changes, then restore the original in a finally block or teardown
(configuration.user_data_collection_configuration = orig) so both test sections
that call store_feedback leave global state unchanged and deterministic.
- Around line 389-405: The test can finish serially because threads are started
sequentially and update_feedback_status has no await; synchronize thread start
so all workers reach the lock concurrently by adding a synchronization primitive
(e.g., threading.Barrier or threading.Event) shared by the test and used in the
worker function before calling update_feedback_status; modify the worker (the
worker function that builds FeedbackStatusUpdateRequest and calls
asyncio.run(update_feedback_status, auth=auth)) to wait on the barrier/event,
initialize and start the threads, then release the barrier/event after all
threads are created so they all call update_feedback_status at the same time,
ensuring the lock inside update_feedback_status is actually contested.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: de5c3955-6c83-4d51-a947-7c3460e09f84

📥 Commits

Reviewing files that changed from the base of the PR and between 6f0cb03 and d9c416e.

📒 Files selected for processing (2)
  • tests/e2e/features/feedback.feature
  • tests/unit/app/endpoints/test_feedback.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (2)
tests/e2e/**/*.{py,feature}

📄 CodeRabbit inference engine (AGENTS.md)

Use behave (BDD) framework for end-to-end testing with Gherkin feature files

Files:

  • tests/e2e/features/feedback.feature
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Use pytest.mark.asyncio marker for async tests

Files:

  • tests/unit/app/endpoints/test_feedback.py
🔇 Additional comments (2)
tests/e2e/features/feedback.feature (2)

315-332: LGTM!


334-368: LGTM!

Comment thread tests/unit/app/endpoints/test_feedback.py
Comment thread tests/unit/app/endpoints/test_feedback.py
Jdubrick added 3 commits June 8, 2026 15:24
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@Jdubrick

Jdubrick commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

/cc @tisnik

@tisnik tisnik 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.

LGTM

@tisnik tisnik merged commit 9e71ccc into lightspeed-core:main Jun 9, 2026
30 checks passed
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