Skip to content

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

Closed

Description

@acinader

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?

Activity

  1. acinader commented on Apr 23, 2017

    @acinader
    ContributorAuthor

    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...

  2. acinader commented on Apr 23, 2017

    @acinader
    ContributorAuthor

    @paulovitin ^^^ thoughts welcome :)

  3. paulovitin commented on Apr 24, 2017

    @paulovitin
    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?

  4. flovilmart commented on Apr 24, 2017

    @flovilmart
    Contributor

    We do, it_excludes_db etc...

  5. vitaly-t commented on Apr 24, 2017

    @vitaly-t
    Contributor

    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 😉

  6. flovilmart commented on Apr 24, 2017

    @flovilmart
    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?

  7. vitaly-t commented on Apr 24, 2017

    @vitaly-t
    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.

  8. acinader commented on Apr 25, 2017

    @acinader
    ContributorAuthor

    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.....

  9. dplewis commented on Mar 23, 2018

    @dplewis
    Member

    Closed via #3822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions