Skip to content

Conversation

@alepane21
Copy link
Contributor

@alepane21 alepane21 commented Jun 25, 2025

Motivation and Context

We are retrying the flaking tests with a github action, that after a failure of a single test is going to retry the whole testsuite. With this PR we are using gotestsum retry instead, that is going to retry only the specific test that is failing.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/cosmo-docs.
  • I have read the Contributors Guide.

Summary by CodeRabbit

  • Chores
    • Simplified and consolidated integration test execution in the workflow, reducing complexity and improving maintainability.
    • Added dedicated commands for running flaky and non-flaky integration tests with appropriate retry and parallelism settings.

@github-actions
Copy link

github-actions bot commented Jun 25, 2025

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-335e34c00c31d1aa2b5932fcff9cb25d2d494819

@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

The integration test workflow was refactored to use a matrix over new Makefile targets, consolidating test execution into a single step per target. The Makefile was updated to add dedicated targets for integration and flaky tests, with specific parameters for retries, timeouts, and test selection, and to generalize the test command.

Changes

Files/Paths Change Summary
.github/workflows/router-ci.yaml Refactored integration test job to use a matrix over make_target, consolidating test steps.
router-tests/Makefile Added integration-tests and integration-tests-flaky targets; updated test target to accept parameters and specify packages.

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

Copy link
Contributor

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

🧹 Nitpick comments (1)
.github/workflows/router-ci.yaml (1)

222-225: Quote the matrix variable to survive special-char targets

Although unlikely today, quoting is a good habit and costs nothing:

-        run: make ${{ matrix.make_target }}
+        run: make "${{ matrix.make_target }}"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04176f8 and e934524.

📒 Files selected for processing (2)
  • .github/workflows/router-ci.yaml (2 hunks)
  • router-tests/Makefile (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/router-ci.yaml

[error] 142-142: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
router-tests/Makefile (1)

51-53: Concurrency flags are contradictory – confirm intent

-p 1 runs one package at a time, while --parallel 10 lets tests within
that single package
spawn up to 10 goroutines.
If the goal is maximum throughput on CI, consider either:

  1. Remove -p 1 to let Go test run multiple packages concurrently; or
  2. Drop --parallel 10 and rely on default intra-package parallelism.

Please double-check which level of parallelism is required for the flaky
tests (some of them are flaky precisely because of parallel execution).

Comment on lines +48 to +50
integration-tests:
$(MAKE) test test_params="-run '^Test[^(Flaky)]' --timeout=10m" test_target="./..."

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Regex does not exclude “Flaky” tests – it matches only one extra rune

^Test[^(Flaky)] is a character class, i.e. it allows exactly one
character that is not “(”, “F”, “l”, “a”, “k”, or “y”.
It will not exclude TestFlaky*; instead it runs almost nothing.

Go test (RE2) lacks negative look-ahead, so a common workaround is:

-	$(MAKE) test test_params="-run '^Test[^(Flaky)]' --timeout=10m" test_target="./..."
+	# run all tests whose name does **not** start with TestFlaky
+	$(MAKE) test test_params="-run '^Test([^F]|F[^l]|Fl[^a]|Fla[^k]|Flak[^y])' --timeout=10m" test_target="./..."

Alternatively, move flaky tests into a separate package or use build tags for
clean separation.
Failing to fix this will leave the non-flaky suite virtually empty.

🤖 Prompt for AI Agents
In router-tests/Makefile around lines 48 to 50, the regex `^Test[^(Flaky)]`
incorrectly uses a character class and does not exclude tests with "Flaky" in
their names, causing almost no tests to run. Replace this regex with a pattern
that matches test names starting with "Test" but excludes those containing
"Flaky" by using a workaround such as `^Test[^F].*` or another suitable pattern
that avoids matching "Flaky" tests, or alternatively separate flaky tests into a
different package or use build tags for exclusion.

Comment on lines +14 to 15
gotestsum $(gotestsum_params) --packages=$(test_target) -f $(FORMAT) -- -ldflags=-extldflags=-Wl,-ld_classic $(test_params) -race $(test_target)

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid passing the package list twice & quote optional params

gotestsum already receives the package list through --packages=$(test_target).
The trailing $(test_target) positional arg is redundant and can break when the
variable is empty/over-ridden. In addition, any of the parameter variables
containing spaces should be quoted to prevent word-splitting.

-	gotestsum $(gotestsum_params) --packages=$(test_target) -f $(FORMAT) -- -ldflags=-extldflags=-Wl,-ld_classic $(test_params) -race $(test_target)
+	gotestsum "$(gotestsum_params)" --packages="$(test_target)" -f "$(FORMAT)" -- -ldflags=-extldflags=-Wl,-ld_classic $(test_params) -race
🤖 Prompt for AI Agents
In router-tests/Makefile around lines 14 to 15, remove the redundant positional
package argument at the end of the gotestsum command since the packages are
already specified with --packages=$(test_target). Also, quote the parameter
variables like "$(gotestsum_params)" and "$(test_params)" to prevent
word-splitting issues when they contain spaces.

Comment on lines +142 to 145
make_target:
- integration-tests
- integration-tests-flaky
services:
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Trailing spaces break YAML-lint & block merges

YAML-lint is already flagging these lines:

Remove the blanks to keep the pipeline green.

-        make_target: 
-          - integration-tests
-          - integration-tests-flaky
+        make_target:
+          - integration-tests
+          - integration-tests-flaky
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
make_target:
- integration-tests
- integration-tests-flaky
services:
make_target:
- integration-tests
- integration-tests-flaky
services:
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 142-142: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/router-ci.yaml around lines 142 to 145, there are trailing
spaces after the list items under make_target which cause YAML-lint errors and
block merges. Remove any trailing spaces at the end of these lines to ensure the
YAML syntax is clean and the pipeline passes linting checks.

@github-actions github-actions bot removed the Stale label Jul 11, 2025
@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 25, 2025
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants