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

CI: add server tests with Postgresql #1278

Closed

Conversation

fflorent
Copy link
Collaborator

Context

See this comment: #1205 (comment)

Some server tests succeeded when using sqlite but failed with postgresql. This commit runs the same tests using a postgresql database to ensure both database types are supported for these tests.

Proposed solution

Make the CI run server tests with Postgresql

Related issues

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Context: some server tests succeeded when using sqlite but failed with
postgresql. This commit runs the same tests using a postgresql database
to ensure both database types are supported for these tests.
@fflorent
Copy link
Collaborator Author

fflorent commented Nov 6, 2024

When Paul has noticed this regression specific to Postgresql, we thought we may also run the tests with this database in github CI. Though it does not seem to be as easy as I first thought. We have understood from @berhalak comment that you already run server tests against this database in your internal CI. Is it possible you either open-source the tests, or share with us how you run them so we can add the same logic to the Github CI, if that makes sense to you?

Or do you think this work is not worth the effort?

@paulfitz
Copy link
Member

paulfitz commented Nov 6, 2024

Is it possible you either open-source the tests, or share with us how you run them so we can add the same logic to the Github CI, if that makes sense to you?

This is what we have:

RUN_gen_server_pg() {
  # Repeat some tests against postgres
  run with_postgres env TEST_CLEAN_DATABASE=true TEST_REDIS_URL=redis://localhost/{redis} TESTDIR=$OUTDIR/testdir \
    $BIN/mocha '_build/test/gen-server/**/*.js' '_build/core/test/gen-server/**/*.js' $MOCHA_FLAGS
}

So we repeat the gen-server tests against postgres. I don't see the server tests running against postgres. They may need modification to do so if they assume the database is a file.

These tests weren't enough to catch the IN () problem, which only showed up in a completely different battery of tests we apply to test the quality of an existing deployment.

@SleepyLeslie
Copy link
Collaborator

Thanks @fflorent for your work! I've done some investigation on the failing tests. Most of the failures are timeouts due to the worse performance of Postgres (compared to SQLite). A significant number of other failures are simply chain effect.

I'm willing to take this forward if you'd like to hand it over to me. As @paulfitz discussed, the scope will be limited to gen-server for now, but within that scope I can see the potential of this PR getting merged. It should be fairly straightforward to fix the gen-server tests (but a decent amount of work to tweak timeout values), and I can later take a look at the nbrowser tests that are currently failing.

@fflorent
Copy link
Collaborator Author

fflorent commented Dec 4, 2024

@SleepyLeslie I would be very pleased and grateful if you complete this work. Thank you very much for your investigation and your proposal to take this over!

@fflorent
Copy link
Collaborator Author

fflorent commented Dec 4, 2024

As @paulfitz discussed, the scope will be limited to gen-server for now

Sounds very wise

Most of the failures are timeouts due to the worse performance of Postgres (compared to SQLite).

Something to do with the #773? Jordi fixed that with -c jit=off option for postgresql.
You may face an issue of Github actions that, IIRC, does not allow passing options to binaries in Docker image (so you might not disable the JIT compiler). If so, we might be able to circumvant the problem by using another (older?) version of postgresql not affected by the performance issues.

@SleepyLeslie
Copy link
Collaborator

Something to do with the #773? Jordi fixed that with -c jit=off option for postgresql.

@fflorent Thanks for the pointer! I was able to run unmodified gen-server tests successfully with JIT turned off.

You may face an issue of Github actions that, IIRC, does not allow passing options to binaries in Docker image

I looked into that and found the environment variable POSTGRES_INITDB_ARGS. With its help I did a successful CI run with Postgres tests: https://github.com/gristlabs/grist-core/actions/runs/12205239155

I don't have write access to your fork so cannot push commits to your PR. I created a branch with my changes in our repo: https://github.com/gristlabs/grist-core/tree/add-postgresql-ci

@fflorent
Copy link
Collaborator Author

fflorent commented Dec 6, 2024

Excellent news!

I don't have write access to your fork so cannot push commits to your PR. I created a branch with my changes in our repo: https://github.com/gristlabs/grist-core/tree/add-postgresql-ci

Please don't hesitate to open another PR. I'll close this one.

@fflorent
Copy link
Collaborator Author

Closing in favor of #1336

@fflorent fflorent closed this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants