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

Use multiple Tigris instances to run tests #1878

Merged
merged 16 commits into from Feb 1, 2023

Conversation

chilagrow
Copy link
Contributor

@chilagrow chilagrow commented Jan 27, 2023

Description

Closes #1568.

Use 4 additional instances for running tests for tigris exposed on ports 8082, 8083, 8085 and 8086. Skipping 8084 because it's used by something else.

On CI, this change appears to runs tigris tests in 6 to 7 minutes. I checked recent merges to main which tigris tests appear to run in 10 to 11min. I don't know how much more $$ it might use.

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), Assignee, Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@chilagrow chilagrow self-assigned this Jan 27, 2023
@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Merging #1878 (bd05d83) into main (1a1fbbc) will decrease coverage by 0.17%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1878      +/-   ##
==========================================
- Coverage   66.11%   65.95%   -0.17%     
==========================================
  Files         312      313       +1     
  Lines       15230    15240      +10     
==========================================
- Hits        10070    10051      -19     
- Misses       4163     4194      +31     
+ Partials      997      995       -2     
Impacted Files Coverage Δ
integration/setup/common.go 93.72% <100.00%> (+0.05%) ⬆️
integration/setup/setup.go 79.06% <100.00%> (ø)
integration/setup/setup_compat.go 82.57% <100.00%> (ø)
integration/setup/startup.go 100.00% <100.00%> (ø)
internal/util/testutil/tigris.go 0.00% <0.00%> (-57.15%) ⬇️
internal/handlers/tigris/tigrisdb/errors.go 21.42% <0.00%> (-21.43%) ⬇️
internal/handlers/tigris/msg_create.go 65.33% <0.00%> (-6.67%) ⬇️
internal/handlers/tigris/tigrisdb/collections.go 61.90% <0.00%> (-4.77%) ⬇️
internal/clientconn/conn.go 44.92% <0.00%> (-2.61%) ⬇️
internal/clientconn/listener.go 75.51% <0.00%> (-1.54%) ⬇️
... and 1 more
Flag Coverage Δ
integration 65.95% <100.00%> (-0.17%) ⬇️
mongodb 14.50% <47.05%> (+0.02%) ⬆️
pg 54.94% <100.00%> (-0.08%) ⬇️
tigris 44.66% <100.00%> (-0.08%) ⬇️

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

@chilagrow chilagrow added the code/chore Code maintenance improvements label Jan 30, 2023
@chilagrow chilagrow marked this pull request as ready for review January 30, 2023 05:33
@chilagrow chilagrow requested review from a team and AlekSi as code owners January 30, 2023 05:33
noisersup
noisersup previously approved these changes Jan 30, 2023
Copy link
Member

@noisersup noisersup left a comment

Choose a reason for hiding this comment

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

Tigris tests faster than PostgreSQL? 😆 I guess it's because of number of skips

LGTM!

Comment on lines +37 to +38
// getNextTigrisPort gets the next port number of Tigris to be used
// for testing in Round Robin fashion.
Copy link
Member

Choose a reason for hiding this comment

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

Nice usage!

rumyantseva
rumyantseva previously approved these changes Jan 30, 2023
Copy link
Member

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

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

I like the idea! Asked a question about configuration.

)

// ports are available port of Tigris.
var ports = []uint16{8081, 8082, 8083, 8085, 8086}
Copy link
Member

Choose a reason for hiding this comment

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

I like this idea, but I'm a bit skeptical about these ports being defined here as the exact number of exact ports and not being configurable.
Is there a plan to make those things configurable (like tigris-url itself) - maybe in separate PRs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've looked at it briefly and decided I would not do it for this, currently there were several places where ports are defined, env tool, docker-compose.yml, and within integrations tests. So it's nice to have configurable but also it touches more than the integration test parameter. For this PR, I'm gonna do quick win. 🙈

Copy link
Member

Choose a reason for hiding this comment

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

Oh, envtool is a nice catch as we wait for 8081 only, and not for the other ports...
I'm ok to merge it as is to have a quick win, and maybe we can reconsider this and make it configurable after #1857 (so, it'll be easier to deal with configuration).

Copy link
Member

Choose a reason for hiding this comment

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

I think we should start paying a bit more attention to our code comments and not leave explanations on GitHub only, where they are unlikely to be found.

In this case, cross-linking those ports to the Docker Compose configuration would significantly improve understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah agree. I've added comments. I also foresee the number of instances are just a guess and need adjusting hence a new issue #1887

Copy link
Member

Choose a reason for hiding this comment

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

See bd05d83

@chilagrow chilagrow enabled auto-merge (squash) January 30, 2023 09:39
w84thesun
w84thesun previously approved these changes Jan 30, 2023
Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

👍

if err != nil {
return err
}
// Skip 8084 because since it is used by userland proxy.
Copy link
Member

Choose a reason for hiding this comment

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

By what "userland proxy"?

Copy link
Contributor Author

@chilagrow chilagrow Jan 31, 2023

Choose a reason for hiding this comment

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

It seems to fail only on CI. https://github.com/FerretDB/FerretDB/actions/runs/4040272813/jobs/6945764486
I updated comment to something a bit more understandable.

Error response from daemon: driver failed programming external connectivity on endpoint ferretdb_speedup_3 (331153047b6e2c6218d96d6ac924a2831bdda68f069b8f8a364d00670cc1484f): Error starting userland proxy: listen tcp4 0.0.0.0:8084: bind: address already in use
task: Failed to run task "env-up-detach": exit status 1

w84thesun
w84thesun previously approved these changes Jan 31, 2023
Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

👍

noisersup
noisersup previously approved these changes Jan 31, 2023
Copy link
Member

@noisersup noisersup left a comment

Choose a reason for hiding this comment

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

:shipit:

rumyantseva
rumyantseva previously approved these changes Jan 31, 2023
Copy link
Member

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

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

LGTM

mergify bot and others added 3 commits February 1, 2023 10:53
Use different ports instead of documenting problems.
Do not copy&paste the same comment; use references instead.
Do not link to closed issue.
@AlekSi AlekSi dismissed stale reviews from rumyantseva, noisersup, and w84thesun via bd05d83 February 1, 2023 19:44
@AlekSi AlekSi changed the title Use multiple ferretdb_tigris docker to run tests Use multiple Tigris instances to run tests Feb 1, 2023
@AlekSi AlekSi disabled auto-merge February 1, 2023 20:11
@AlekSi AlekSi enabled auto-merge (squash) February 1, 2023 20:11
@AlekSi AlekSi added this to the v0.9.1 milestone Feb 1, 2023
@AlekSi AlekSi disabled auto-merge February 1, 2023 20:11
@AlekSi AlekSi merged commit c044fd4 into FerretDB:main Feb 1, 2023
@chilagrow
Copy link
Contributor Author

Thank you for the clean up @AlekSi 🤗

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
None yet
Development

Successfully merging this pull request may close these issues.

Rework integration test setup and auth
5 participants