Skip to content

feat(test): divide unit and integration test; save coverage artiface to codecov #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025

Conversation

Dav-14
Copy link
Contributor

@Dav-14 Dav-14 commented Jul 9, 2025

No description provided.

@Dav-14 Dav-14 requested a review from a team as a code owner July 9, 2025 15:42
Copy link

coderabbitai bot commented Jul 9, 2025

Walkthrough

The .gitignore was updated to ignore the coverage directory. The Justfile was modified to rename the combined test target and add coverage reporting for both unit and integration tests. //go:generate directives for cloning the operator repository were moved from test files to main.go, and CRD directory paths in test setup were updated.

Changes

File(s) Change Summary
.gitignore Added coverage directory to ignored files.
Justfile Renamed tests-all to tests; added coverage reporting and filtering to test targets; updated comments.
internal/membership_listener_test.go,
tests/main_test.go Removed //go:generate directives for operator repo cloning; updated CRD directory path.
main.go Added //go:generate directives to clone operator repo before build.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Justfile
    participant GoTest
    participant Ginkgo
    participant CoverageDir

    Developer->>Justfile: Run `just tests`
    Justfile->>GoTest: Run unit tests with coverage
    GoTest->>CoverageDir: Output coverage/unit.txt
    Justfile->>Ginkgo: Run integration tests with coverage
    Ginkgo->>CoverageDir: Output coverage/integration.txt
    Justfile->>CoverageDir: Filter and save coverage files
Loading

Possibly related PRs

  • chore: use nix just #119: Introduces a new Justfile and modifies operator repo cloning directives and CRD paths in test files, overlapping with the changes in this PR.

Suggested reviewers

  • gfyrag

Poem

In the warren where tests now run,
Coverage grows beneath the sun.
Directives hop to main’s abode,
While CRD paths take a new road.
The rabbit cheers for tidy code—
With filtered files and changes shown,
The garden of tests has neatly grown! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/coverage

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Base automatically changed from feat/debug_kube_request to main July 9, 2025 16:01
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: GoReleaser No Longer Checks Repository Cleanliness

The GoReleaser job no longer depends on the Dirty job, which previously ensured the repository had no uncommitted changes. This allows releases to be built from an unclean or inconsistent repository state. While the Deploy job still retains this dependency, a critical safety check for the release creation process has been removed.

.github/workflows/main.yml#L110-L112

runs-on: "shipfox-4vcpu-ubuntu-2404"
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
steps:

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@Dav-14 Dav-14 merged commit a70ba00 into main Jul 9, 2025
8 of 9 checks passed
@Dav-14 Dav-14 deleted the feat/coverage branch July 9, 2025 16:06
Copy link

codecov bot commented Jul 9, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Copy link

@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: 0

🧹 Nitpick comments (1)
Justfile (1)

27-27: Address the race flag TODO comments.

The TODO comments indicate that running tests with the -race flag needs to be fixed. This is important for detecting race conditions in concurrent code.

Would you like me to help investigate why the race flag is problematic and suggest potential solutions?

Also applies to: 36-36

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc6b56a and 2d01dc8.

⛔ Files ignored due to path filters (2)
  • .github/workflows/main.yml is excluded by !**/*.yml
  • Taskfile.yaml is excluded by !**/*.yaml
📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • Justfile (2 hunks)
  • internal/membership_listener_test.go (1 hunks)
  • main.go (1 hunks)
  • tests/main_test.go (1 hunks)
⏰ 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: Dirty
🔇 Additional comments (7)
.gitignore (1)

12-12: LGTM: Coverage directory properly ignored.

Adding the coverage directory to .gitignore is appropriate since the Justfile changes generate coverage artifacts in this directory. This prevents coverage reports from being committed to version control.

main.go (1)

8-9: Centralized go:generate directives for operator validated

I’ve verified that:

  • The only references to //go:generate rm -rf ./dist/operator and the subsequent clone are in main.go.
  • No other parts of the codebase reference dist/operator.
  • Existing go:generate directives elsewhere are for mocks and won’t be affected.

This setup won’t run during normal builds—only when go generate is explicitly invoked—so it won’t interfere with application builds or tests.

(Optional) You may want to document this behavior in your README or Makefile so that other contributors are aware that running go generate in the root will re-clone the operator.

tests/main_test.go (1)

41-42: Path update is consistent with the reorganization.

The CRD directory path update from dist/operator to ../dist/operator is correct since the operator repository is now cloned at the root level (via main.go). This ensures the test environment can properly locate the CRD files.

internal/membership_listener_test.go (1)

44-45: Path update maintains consistency across test files.

The CRD directory path update from dist/operator to ../dist/operator is consistent with the changes in tests/main_test.go and aligns with the operator repository now being cloned at the root level.

Justfile (3)

10-10: Target rename aligns with test reorganization.

Renaming tests-all to tests simplifies the interface and aligns with the new structure where unit and integration tests are run separately but combined under a single target.


31-34: Unit test coverage configuration looks solid.

The coverage setup for unit tests is well-configured:

  • Creates coverage directory appropriately
  • Uses atomic coverage mode for concurrent testing
  • Filters out appropriate paths from coverage reports
  • Saves both raw and filtered coverage files

40-43: Please verify Ginkgo flags and coverage filters in Justfile

Ensure that the ginkgo -r -p --output-interceptor-mode=none --output-dir=coverage --covermode atomic --cover --coverprofile=integration.txt --timeout "10m" --coverpkg=./internal/... ./tests invocation uses only supported flags and that each flag is necessary for your integration test runs. Also confirm your coverage-filtering regex only excludes the intended files.

• Double-check support for:

  • --output-interceptor-mode=none
  • --output-dir
  • --covermode
  • --coverprofile
  • --coverpkg

• Validate the grep exclusion pattern:
generated|pkg|web|tests/integration|with_trace|noop

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