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

feat: Add support for longtests during CI #3054

Merged
merged 3 commits into from
Jun 30, 2024
Merged

feat: Add support for longtests during CI #3054

merged 3 commits into from
Jun 30, 2024

Conversation

gaby
Copy link
Member

@gaby gaby commented Jun 30, 2024

Description

  • Added support for running tests 15 times with go1.21 and go1.22 using ubuntu-latest.
  • Renamed build to unit in the test.yml workflow
  • Remove installation of gotestsum, since it can be called using go run
  • Always use latest gotestsum.

This should help detect future race-conditions that only happen when tests are run more than once but using GitHub Actions.

Type of change

  • Code consistency (non-breaking change which improves code reliability and robustness)

@gaby gaby added the v3 label Jun 30, 2024
@gaby gaby requested a review from a team as a code owner June 30, 2024 17:37
@gaby gaby requested review from sixcolors, ReneWerner87 and efectn and removed request for a team June 30, 2024 17:37
Copy link
Contributor

coderabbitai bot commented Jun 30, 2024

Walkthrough

This update enhances the test automation setup by renaming and adding jobs, updating dependencies, and increasing test repetitions. In .github/workflows/test.yml, jobs are renamed and new jobs introduced to streamline and intensify testing processes. The Makefile adjustments also aim to raise the test repetition count, ensuring more robust testing cycles.

Changes

File Change Summary
.github/workflows/test.yml Renames Build to unit, updates gotestsum installation, modifies test execution, and adds repeated job running tests 15 times; changes LongTest to run tests 25 times.
Makefile Updates longtest target to increase the test execution count from 10 to 15.

Sequence Diagram(s)

None required as changes were limited to enhancing existing testing processes without affecting control flow.

Poem

In the land of code, where tests do bloom,
We added more sparks to chase the gloom.
Jobs renamed, dependencies bright,
Fifteen or twenty-five, we make it right!
With every build, a stronger thread,
Hopping along in the green pastures ahead. 🌱🛠️🐇


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

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 testing code 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 testing code 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 testing code.
    • @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.

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 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.
  • 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

codecov bot commented Jun 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.01%. Comparing base (0400af6) to head (6ef0088).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3054   +/-   ##
=======================================
  Coverage   83.01%   83.01%           
=======================================
  Files         115      115           
  Lines        8314     8314           
=======================================
  Hits         6902     6902           
  Misses       1078     1078           
  Partials      334      334           
Flag Coverage Δ
unittests 83.01% <ø> (ø)

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.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 83731ce and 384da15.

Files selected for processing (1)
  • .github/workflows/test.yml (3 hunks)
Additional comments not posted (2)
.github/workflows/test.yml (2)

Line range hint 18-34: Ensure the correctness of the gotestsum command.

The gotestsum command has been updated to use go run gotest.tools/gotestsum@latest. Ensure that this command works as expected across all specified platforms and Go versions.

Verification successful

Ensure the correctness of the gotestsum command.

The gotestsum command has been updated to use go run gotest.tools/gotestsum@latest. The verification confirms that this command works as expected.

  • The gotestsum command successfully executed and displayed the version information.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `gotestsum` command works as expected across all specified platforms and Go versions.

# Test: Run the `gotestsum` command. Expect: Successful execution.
go run gotest.tools/gotestsum@latest --version

Length of output: 118



Script:

#!/bin/bash
# Description: Install Go, verify the `gotestsum` command works as expected across all specified platforms and Go versions.

# Step 1: Install Go
curl -sSL https://golang.org/dl/go1.21.1.linux-amd64.tar.gz -o go1.21.1.linux-amd64.tar.gz
tar -xzf go1.21.1.linux-amd64.tar.gz
export PATH=$PATH:$(pwd)/go/bin

# Step 2: Run the `gotestsum` command. Expect: Successful execution.
go run gotest.tools/gotestsum@latest --version

Length of output: 461



Script:

#!/bin/bash
# Description: Install Go, set up the environment, and verify the `gotestsum` command works as expected across all specified platforms and Go versions.

# Step 1: Install Go
curl -sSL https://golang.org/dl/go1.21.1.linux-amd64.tar.gz -o go1.21.1.linux-amd64.tar.gz
tar -xzf go1.21.1.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export PATH=$PATH:$GOROOT/bin

# Step 2: Run the `gotestsum` command. Expect: Successful execution.
go run gotest.tools/gotestsum@latest --version

Length of output: 1199


45-61: Ensure the correctness of the gotestsum command.

The gotestsum command has been updated to use go run gotest.tools/gotestsum@latest. Ensure that this command works as expected for running tests 25 times.

Verification successful

Ensure the correctness of the gotestsum command.

The gotestsum command has been confirmed to work correctly. The command go run gotest.tools/gotestsum@latest will correctly run tests 25 times as expected.

  • The gotestsum version command executed successfully, confirming the tool is correctly installed and available in the PATH.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `gotestsum` command works as expected for running tests 25 times.

# Test: Run the `gotestsum` command. Expect: Successful execution.
go run gotest.tools/gotestsum@latest --version

Length of output: 118



Script:

#!/bin/bash
# Description: Install Go and verify the `gotestsum` command works as expected for running tests 25 times.

# Step 1: Install Go
curl -LO https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

# Step 2: Verify the `gotestsum` command
go install gotest.tools/gotestsum@latest
gotestsum --version

Length of output: 1240



Script:

#!/bin/bash
# Description: Install Go in the current directory and verify the `gotestsum` command works as expected for running tests 25 times.

# Step 1: Install Go
curl -LO https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C . -xzf go1.21.1.linux-amd64.tar.gz
export PATH=$PATH:$(pwd)/go/bin

# Step 2: Verify the `gotestsum` command
go install gotest.tools/gotestsum@latest
gotestsum --version

Length of output: 1084



Script:

#!/bin/bash
# Description: Install Go in the current directory, set GOROOT, and verify the `gotestsum` command works as expected for running tests 25 times.

# Step 1: Install Go
curl -LO https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C . -xzf go1.21.1.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export PATH=$PATH:$GOROOT/bin

# Step 2: Verify the `gotestsum` command
go install gotest.tools/gotestsum@latest
gotestsum --version

Length of output: 1157



Script:

#!/bin/bash
# Description: List the Go bin directory and verify the `gotestsum` command works as expected for running tests 25 times.

# Step 1: Install Go
curl -LO https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C . -xzf go1.21.1.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export PATH=$PATH:$GOROOT/bin

# Step 2: Install gotestsum
go install gotest.tools/gotestsum@latest

# Step 3: List the Go bin directory and verify the `gotestsum` command
ls $GOROOT/bin
ls $(go env GOPATH)/bin
gotestsum --version

Length of output: 1168



Script:

#!/bin/bash
# Description: Add the GOPATH bin directory to the PATH and verify the `gotestsum` command works as expected for running tests 25 times.

# Step 1: Install Go
curl -LO https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C . -xzf go1.21.1.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export PATH=$PATH:$GOROOT/bin

# Step 2: Install gotestsum
go install gotest.tools/gotestsum@latest

# Step 3: Add GOPATH bin directory to PATH and verify the `gotestsum` command
export PATH=$PATH:$(go env GOPATH)/bin
gotestsum --version

Length of output: 1274

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 384da15 and a0a51b9.

Files selected for processing (2)
  • .github/workflows/test.yml (4 hunks)
  • Makefile (1 hunks)
Files skipped from review due to trivial changes (1)
  • Makefile
Additional comments not posted (4)
.github/workflows/test.yml (4)

19-19: Job name updated for clarity.

Renaming the Build job to unit improves clarity and aligns with the job's purpose.


35-35: Update test command to use latest gotestsum.

The command now uses go run gotest.tools/gotestsum@latest, which ensures the latest version is used without needing a separate installation step.


46-46: Add a new job for repeated tests.

The repeated job is a valuable addition to detect race conditions by running tests multiple times.


62-62: Run tests multiple times to catch race conditions.

The command runs tests 15 times, which should help in detecting race conditions.

.github/workflows/test.yml Show resolved Hide resolved
@ReneWerner87 ReneWerner87 merged commit a18e8a8 into main Jun 30, 2024
17 checks passed
@gaby gaby deleted the longtests branch July 21, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants