Skip to content
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

chore: Enabling shuffling, cleanup and consistency across tests #2931

Merged
merged 3 commits into from
Mar 24, 2024

Conversation

gaby
Copy link
Member

@gaby gaby commented Mar 24, 2024

Description

  • Add -shuffle=on which tells Go to run tests in different orders. This should help us catch tests depending on others to pass.
  • Updated Tests and Benchmarks that had inconsistent names.
  • Added Makefile to ease consistency for maintainers, and contributors
  • Cleanup and updates to README.md

Makefile Menu

image

Changes introduced

List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.

  • Documentation Update: Detail the updates made to the documentation and links to the changed files.

Type of change

Please delete options that are not relevant.

  • Documentation update (changes to documentation)
  • Code consistency (non-breaking change which improves code reliability and robustness)

Summary by CodeRabbit

  • Documentation

    • Enhanced the README with clearer framework emphasis, updated installation guidelines, and a caution note for v3 beta users.
    • Added development-related commands to the Makefile documentation.
  • Chores

    • Introduced Makefile commands for various development tasks like quality checks, benchmarking, code formatting, lint checks, and dependency cleanup.
    • Expanded .gitignore to universally exclude *.out files, improving coverage tool output management.
  • Tests

    • Adjusted test execution through the gotestsum command to include test shuffling.
    • Standardized test function naming across various test files for better consistency and clarity.

@gaby gaby requested a review from a team as a code owner March 24, 2024 03:56
@gaby gaby requested review from sixcolors, ReneWerner87 and efectn and removed request for a team March 24, 2024 03:56
Copy link
Contributor

coderabbitai bot commented Mar 24, 2024

Walkthrough

This update enhances a project by emphasizing framework names, refining installation instructions, and introducing a caution for a beta version. It adds development commands to the Makefile and improves code quality across various tests and middleware components. Changes include renaming test functions for consistency, expanding .gitignore rules, and adjusting workflow commands for better testing practices.

Changes

Files Change Summaries
.github/README.md, Makefile Emphasized framework name, updated instructions, added caution for beta, introduced Makefile commands, adjusted logging and server start method.
.github/workflows/test.yml Modified gotestsum command to include -shuffle=on.
.gitignore Expanded exclusion to all **/*.out files.
addon/.../exponential_backoff_test.go,
app_test.go,
client/.../cookiejar_test.go,
ctx_test.go,
error_test.go,
middleware/.../manager_msgp_test.go,
middleware/cors/utils_test.go,
middleware/csrf/...,
middleware/envvar/...,
middleware/idempotency/...,
middleware/keyauth/...,
middleware/limiter/...,
middleware/session/store_test.go
Renamed test and benchmark functions for consistency and clarity, including prefixing with underscores and changing case.

🐰✨
In a land of code and byte,
Changes swift, through day and night.
Tests renamed, with care and might,
.gitignore now just right.
Amidst the lines, a rabbit's delight.
🌟📜✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests for this file.
    • 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 generate unit tests for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Mar 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.75%. Comparing base (5e8df0a) to head (ef615ad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2931   +/-   ##
=======================================
  Coverage   82.75%   82.75%           
=======================================
  Files         116      116           
  Lines        8396     8396           
=======================================
  Hits         6948     6948           
  Misses       1108     1108           
  Partials      340      340           
Flag Coverage Δ
unittests 82.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5e8df0a and ef615ad.
Files selected for processing (17)
  • .github/README.md (11 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • addon/retry/exponential_backoff_test.go (2 hunks)
  • app_test.go (1 hunks)
  • client/cookiejar_test.go (6 hunks)
  • ctx_test.go (23 hunks)
  • error_test.go (1 hunks)
  • middleware/cache/manager_msgp_test.go (4 hunks)
  • middleware/cors/utils_test.go (3 hunks)
  • middleware/csrf/manager_msgp_test.go (4 hunks)
  • middleware/envvar/envvar_test.go (6 hunks)
  • middleware/idempotency/response_msgp_test.go (3 hunks)
  • middleware/keyauth/keyauth_test.go (6 hunks)
  • middleware/limiter/manager_msgp_test.go (4 hunks)
  • middleware/session/store_test.go (3 hunks)
Files skipped from review due to trivial changes (3)
  • Makefile
  • middleware/envvar/envvar_test.go
  • middleware/idempotency/response_msgp_test.go
Additional comments: 35
.gitignore (1)
  • 13-13: The change to ignore all *.out files in any directory is a good practice to keep the repository clean from temporary files generated during tests or coverage analysis.
.github/workflows/test.yml (1)
  • 37-37: Adding the -shuffle=on flag to the gotestsum command is a positive change that promotes test independence and reliability by enabling test shuffling.
middleware/csrf/manager_msgp_test.go (2)
  • 11-11: Renaming test functions to include underscores improves consistency and readability.
  • 34-34: Renaming benchmark functions to include underscores enhances consistency across the test suite.
middleware/cache/manager_msgp_test.go (2)
  • 11-11: Consistent renaming of test functions with underscores enhances readability.
  • 34-34: The consistent use of underscores in benchmark function names improves the test suite's consistency.
middleware/limiter/manager_msgp_test.go (2)
  • 11-11: Renaming for consistency with underscores in test function names is a good practice.
  • 34-34: Consistent use of underscores in benchmark function names is beneficial for readability.
error_test.go (1)
  • 12-12: Renaming test functions with underscores improves consistency and readability across the test suite.
middleware/session/store_test.go (1)
  • 13-13: Adding underscores to test function names for consistency is a good practice.
addon/retry/exponential_backoff_test.go (1)
  • 11-11: Renaming test functions with underscores for consistency is a positive change.
client/cookiejar_test.go (1)
  • 25-25: The test function names have been updated to follow a consistent naming convention by prefixing them with "Test_". This change aligns with the PR's objective to improve readability and maintainability.
middleware/cors/utils_test.go (1)
  • 10-10: The test function names have been updated to follow a consistent naming convention by capitalizing the first letter after "Test_". This change aligns with the PR's objective to improve readability and maintainability.
middleware/keyauth/keyauth_test.go (1)
  • 17-17: The test function names have been updated to follow a consistent naming convention by prefixing them with "Test_". This change aligns with the PR's objective to improve readability and maintainability.
.github/README.md (5)
  • 29-29: The emphasis on the framework name "Fiber" enhances readability and effectively highlights the framework's name. Good job!
  • 33-33: The addition of the caution section for v3 beta is well-executed. It's important for setting the right expectations for users experimenting with the beta version.
  • 40-42: The updated installation instructions are clear and concise, effectively guiding users through setting up a project with Fiber. Mentioning the Go version requirement is crucial and well-handled.
  • 629-641: The introduction of development-related Makefile commands is a valuable addition, standardizing and streamlining the development process. This is a great practice for improving project maintainability and developer experience.
  • 62-72: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [65-82]

The addition of logging imports and the update to the server start method in the example code are practical improvements, enhancing the robustness and usability of the examples provided.

app_test.go (1)
  • 1812-1812: The renaming of the test function from TestApp_GetRoutes to Test_App_GetRoutes aligns with the PR's objective of improving test and benchmark naming consistency. This change enhances readability and follows Go's convention for naming test functions, which typically start with Test followed by the name of the function being tested. The underscore (_) improves the separation between the Test prefix and the function name, making it clearer and more consistent with other tests in the project.
ctx_test.go (15)
  • 4564-4564: Looks good! The test cases cover a wide range of integer values, including edge cases.
  • 4618-4618: Looks good! The test cases cover a wide range of int8 values, including edge cases.
  • 4669-4669: Looks good! The test cases cover a wide range of int16 values, including edge cases.
  • 4719-4719: Looks good! The test cases cover a wide range of int32 values, including edge cases.
  • 4769-4769: Looks good! The test cases cover a wide range of int64 values, including edge cases.
  • 4820-4820: Looks good! The test cases cover a wide range of uint values.
  • 4862-4862: Looks good! The test cases cover a wide range of uint8 values, including the maximum value.
  • 4908-4908: Looks good! The test cases cover a wide range of uint16 values, including the maximum value.
  • 4955-4955: Looks good! The test cases cover a wide range of uint32 values, including the maximum value.
  • 5002-5002: Looks good! The test cases cover a wide range of uint64 values.
  • 5044-5044: Looks good! The test cases cover a wide range of float32 values, including decimal numbers.
  • 5083-5083: Looks good! The test cases cover a wide range of float64 values, including decimal numbers.
  • 5122-5122: Looks good! The test cases cover a wide range of byte array values, including strings and empty values.
  • 5161-5161: Looks good! The test cases cover a wide range of boolean values, including true and false in different cases.
  • 5205-5205: Looks good! The test cases cover a wide range of string values.

@gaby gaby changed the title chore: Enabling shuffling of unit-tests, cleanup and consistency across tests chore: Enabling shuffling, cleanup and consistency across tests Mar 24, 2024
@ReneWerner87 ReneWerner87 added this to the v3 milestone Mar 24, 2024
@ReneWerner87 ReneWerner87 merged commit 95c1814 into main Mar 24, 2024
15 of 16 checks passed
@efectn efectn deleted the test-shuffle branch May 22, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants