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

Implement envtool tests shard command #2773

Merged
merged 16 commits into from
Jun 8, 2023

Conversation

kropidlowsky
Copy link
Contributor

@kropidlowsky kropidlowsky commented Jun 1, 2023

Description

Closes #2692.

Implemented envtool tests shard command.

  • Command example: go run ./cmd/envtool tests shard --index=0 --total=2
  • Usage of the command with go test - it does not contain required flags for integration tests: go test -run regexp="$(go run ../cmd/envtool tests shard --index=0 --total=2)" - works in the integration folder

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@kropidlowsky kropidlowsky requested a review from a team as a code owner June 1, 2023 22:55
@kropidlowsky kropidlowsky requested review from AlekSi and chilagrow June 1, 2023 22:55
@AlekSi AlekSi added the code/chore Code maintenance improvements label Jun 2, 2023
@AlekSi AlekSi added this to the Next milestone Jun 2, 2023
cmd/envtool/envtool.go Outdated Show resolved Hide resolved
cmd/envtool/envtool.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
Copy link
Member

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

I have few comments. Let` me know if you need any help with this task 🤗

cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests_test.go Show resolved Hide resolved
cmd/envtool/tests.go Show resolved Hide resolved
cmd/envtool/tests_test.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
@AlekSi AlekSi modified the milestones: v1.3.0, Next Jun 5, 2023
@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Merging #2773 (a4a07ed) into main (33865a6) will decrease coverage by 37.10%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2773       +/-   ##
===========================================
- Coverage   63.81%   26.71%   -37.10%     
===========================================
  Files         442      442               
  Lines       22519    22519               
===========================================
- Hits        14370     6016     -8354     
- Misses       7210    15886     +8676     
+ Partials      939      617      -322     

see 144 files with indirect coverage changes

Flag Coverage Δ
integration 5.00% <ø> (-51.85%) ⬇️
mongodb 5.00% <ø> (ø)
pg ?
unit 25.19% <ø> (+0.02%) ⬆️

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

@kropidlowsky kropidlowsky requested review from AlekSi and chilagrow June 6, 2023 21:36
@kropidlowsky
Copy link
Contributor Author

Hi @chilagrow and @AlekSi,

Could you please take look again?
I have tried to align the code to your reviews + made some small refactoring.

Thanks in advance!

Copy link
Member

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

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

Looks great. I have minor comments about linter warnings 🤗

cmd/envtool/envtool.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Show resolved Hide resolved
cmd/envtool/tests_test.go Show resolved Hide resolved
@kropidlowsky kropidlowsky requested a review from chilagrow June 7, 2023 21:43
Copy link
Member

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

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

Great! Being able to run subsets of tests like this is amazing 🤗

$ GOFLAGS="-run=$(go run ./cmd/envtool tests shard --index=0 --total=30) -parallel=1" task test-integration-pg
task: [test-integration-pg] go test -count=1 -timeout=35m -race=true -tags=ferretdb_debug,ferretdb_tigris,ferretdb_hana -shuffle=on -coverpkg=../... -coverprofile=integration-pg.txt . -target-backend=ferretdb-pg -target-tls -postgresql-url=postgres://username@127.0.0.1:5432/ferretdb -compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem'

ok      github.com/FerretDB/FerretDB/integration        11.738s coverage: 40.0% of statements in ../...

@AlekSi AlekSi enabled auto-merge (squash) June 8, 2023 11:11
@AlekSi AlekSi merged commit 1c1c435 into FerretDB:main Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement envtool tests shard command
3 participants