Skip to content

test: merge integration tests in single package#3629

Closed
chronark wants to merge 4 commits intomainfrom
07-17-test_merge_integration_tests_in_single_package
Closed

test: merge integration tests in single package#3629
chronark wants to merge 4 commits intomainfrom
07-17-test_merge_integration_tests_in_single_package

Conversation

@chronark
Copy link
Collaborator

@chronark chronark commented Jul 17, 2025

What does this PR do?

Consolidates rate limiting integration tests into a single package to improve test organization and execution. This change:

  1. Modifies the test generator to place all tests in a single generated package instead of creating separate packages for each test case
  2. Renames test files to follow a consistent naming pattern based on test parameters
  3. Removes the PackageName() function which is no longer needed
  4. Updates template variable name from tmpl to testTmpl for clarity
  5. Adds feedback during generation to show the first 5 generated files

Type of change

  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)

How should this be tested?

  • Run go generate in the multi_node_ratelimiting directory to verify tests are generated correctly
  • Run the generated tests to ensure they still function properly: go test ./go/apps/api/integration/multi_node_ratelimiting/generated/...

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • My changes don't cause any responsiveness issues

Summary by CodeRabbit

  • Refactor
    • Test files are now generated directly under a single "generated" directory with a fixed package name, simplifying the file structure.
    • Test file names are now based on the test case name for easier identification.
    • Improved feedback during generation by printing the names of the first few generated files.
    • Updated output messages to reflect the new file organization.

@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2025

⚠️ No Changeset found

Latest commit: e6a63c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
dashboard ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 8:49am
engineering ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 8:49am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

📝 Walkthrough

Walkthrough

The code was refactored to remove per-test-case package generation for test files. All generated test files are now placed in a single generated directory with a fixed package name. The file naming convention was updated, and some variable names and output messages were clarified.

Changes

File(s) Change Summary
go/apps/api/integration/multi_node_ratelimiting/generate_tests/main.go Removed TestCase.PackageName() method; switched to fixed package name; updated file naming and output logic; minor variable renaming.

Suggested reviewers

  • perkinsjr

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 419a1d4 and 24fcb69.

⛔ Files ignored due to path filters (54)
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0005_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes01_limit0100_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0005_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes03_limit0100_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0005_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000001000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000001000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000001000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000060000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000060000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration000060000_load10_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration003600000_load00_90_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration003600000_load02_00_windows010_test.go is excluded by !**/generated/**
  • go/apps/api/integration/multi_node_ratelimiting/generated/integration_ratelimit_nodes09_limit0100_duration003600000_load10_00_windows010_test.go is excluded by !**/generated/**
📒 Files selected for processing (1)
  • go/apps/api/integration/multi_node_ratelimiting/generate_tests/main.go (4 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). (6)
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Test Agent Local / test_agent_local
  • GitHub Check: Build / Build
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
go/apps/api/integration/multi_node_ratelimiting/generate_tests/main.go (4)

44-44: LGTM: Package name consolidation implemented correctly.

The hardcoded package name generated successfully consolidates all test files into a single package as intended by the PR objective.


86-86: LGTM: Variable name improved for clarity.

The rename from tmpl to testTmpl makes the variable purpose more explicit and improves code readability.


111-134: LGTM: File generation logic correctly implements single package structure.

The refactored file generation logic successfully:

  • Generates all test files directly in the generated directory
  • Creates descriptive filenames based on test parameters
  • Provides helpful feedback for the first 5 generated files
  • Properly handles file creation and cleanup

The filename generation using strings.ToLower(tc.TestName()[4:]) cleverly removes the "Test" prefix and converts to lowercase for consistent naming.


136-136: LGTM: Output message accurately reflects the new structure.

The updated message correctly communicates that test files are generated in a single generated package rather than multiple packages.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@chronark chronark mentioned this pull request Jul 17, 2025
18 tasks
Copy link
Collaborator Author

chronark commented Jul 17, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vercel vercel bot temporarily deployed to Preview – engineering July 17, 2025 10:38 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard July 17, 2025 10:38 Inactive
@chronark chronark marked this pull request as ready for review July 17, 2025 10:38
chronark added 2 commits July 17, 2025 13:24
we now try to listen on a random port assigned by the OS and never
stop listening until the tests are done.

This prevents the race conditions between assigning a port and using it
Go test would build each package before discovering that it should
be skipped. Now it just needs to build one package.

We're not sharding tests in CI anymore, so this is fine.
@chronark chronark force-pushed the 07-17-test_merge_integration_tests_in_single_package branch from 43cdf11 to 46ba360 Compare July 17, 2025 11:25
@chronark chronark force-pushed the 07-17-fix_port_allocation_in_tests branch from 96638e7 to c3fa9b5 Compare July 17, 2025 11:25
@github-actions
Copy link
Contributor

github-actions bot commented Jul 17, 2025

Thank you for following the naming conventions for pull request titles! 🙏

@graphite-app
Copy link

graphite-app bot commented Jul 17, 2025

Video gif. A man sits in the driver seat of a car. He turns his head slowly, looking a bit worried. He looks at us and a smile spreads across his face. He gives us a big thumbs up.  (Added via Giphy)

@vercel vercel bot temporarily deployed to Preview – engineering July 17, 2025 11:28 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard July 17, 2025 11:29 Inactive
@graphite-app
Copy link

graphite-app bot commented Jul 17, 2025

Graphite Automations

"Post a GIF when PR approved" took an action on this PR • (07/17/25)

1 gif was posted to this PR based on Andreas Thomas's automation.

"Notify author when CI fails" took an action on this PR • (07/17/25)

1 teammate was notified to this PR based on Andreas Thomas's automation.

Copy link
Collaborator Author

ooh sweet child, you’ll be so dissapointed when graphite invalidates this one

Copy link
Member

I used graphite to approve it. :pepehands:

Copy link
Collaborator Author

again I don’t think that makes any difference 😄
cause github invalidates your review once the first stacked PR gets merged and the top stack is rebased

but let’s see

Base automatically changed from 07-17-fix_port_allocation_in_tests to main July 17, 2025 12:36
@vercel vercel bot temporarily deployed to Preview – dashboard July 17, 2025 12:47 Inactive
@chronark chronark enabled auto-merge July 17, 2025 13:21
Copy link
Collaborator Author

I think this one is a lost cause, github now consistently kills the tests for consuming too much CPU 😄

Copy link
Member

Flo4604 commented Jul 22, 2025

🙃

@chronark chronark closed this Jul 24, 2025
auto-merge was automatically disabled July 24, 2025 16:20

Pull request was closed

@Flo4604 Flo4604 deleted the 07-17-test_merge_integration_tests_in_single_package branch July 29, 2025 13:07
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.

3 participants