Skip to content

pg-promise init options causes local test to fail #3745

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

Closed
acinader opened this issue Apr 23, 2017 · 9 comments
Closed

pg-promise init options causes local test to fail #3745

acinader opened this issue Apr 23, 2017 · 9 comments

Comments

@acinader
Copy link
Contributor

the pr #3613 introduces two unit tests that test postgres.

the parse-server test machinery only sets up a mongo test server, not a postgres test server, so if one is not running postgres, these test will fail when tests are run locally.

Running tests before creating a pr is a Good Thing™.

Would seem that there are two options here:

  1. figure out how to conditionally not run these tests if postgres is not being tested
  2. add postgres to test helper setup so the tests test....

Any thoughts? Would seem that option 2 is better even though it'd likely make tests take longer?

@acinader
Copy link
Contributor Author

uh-oh "should fail to create server if schema databaseOptions does not exist" appears to be flaky too. on travis, it failed with something like "expected 3000 to be 42P01" but when i re-ran it it just worked :( -- after looking back and seeing that it had worked on the initial commit...

@acinader
Copy link
Contributor Author

acinader commented Apr 23, 2017

@paulovitin ^^^ thoughts welcome :)

@paulovitin
Copy link
Contributor

@acinader for test postgres we need the env var PARSE_SERVER_TEST_DB to run in postgres. Why not to use this for conditionally not run these tests?

@flovilmart
Copy link
Contributor

We do, it_excludes_db etc...

@vitaly-t
Copy link
Contributor

vitaly-t commented Apr 24, 2017

pg-promise init options causes local test to fail

The titled alarmed at first as an issue with pg-promise, but then reading through posts, plus that PR, seems like it is not really an issue with the library, rather with how tests are being run...?

Anyway, I'm here to help figure it out, if needed 😉

@flovilmart
Copy link
Contributor

Would it be possible that the connect call is not run sometimes? I know mongo connects on the 1st call but not on new instance or that reconfigureServer swallows the error?

@vitaly-t
Copy link
Contributor

On every query request pg-promise acquires next available connection from the pool. When no connection has been created yet, a new one is created. The connection is released back to the pool immediately after the query execution. It is only different when using explicit connect method, which I believe is not used by this library.

@acinader
Copy link
Contributor Author

ok, bad me for putting two separate issues into one issue....

I just opened #3754 for the flaky tests failures.

So this issue should just address running tests locally if you don't have postgres setup causes spec/PostgresInitOptions.spec.js tests to fail.....

@dplewis
Copy link
Member

dplewis commented Mar 23, 2018

Closed via #3822

@dplewis dplewis closed this as completed Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants