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

Confusion Setting Up A Dev Environment #2144

Open
chriskchew opened this issue Mar 25, 2020 · 3 comments
Open

Confusion Setting Up A Dev Environment #2144

chriskchew opened this issue Mar 25, 2020 · 3 comments

Comments

@chriskchew
Copy link
Contributor

@chriskchew chriskchew commented Mar 25, 2020

Hello!

I want to set up the development environment in order to make a PR with some pool changes needed to improve adoption of scale-up read replicas in AWS Aurora, but I'm having trouble setting up my repository workspace to run the tests.

I have tried running npm i and npm test in all the package sub-directories, as well as the workspace root.

There seems to be a bit of a circular dependency between pg -> pg-pool -> pg-cursor -> pg. I'm wondering if there is just some trick project devs do to get past this that perhaps isn't documented?

What are the steps to get a dev environment running with tests passing? I can include documenting these steps in the PR I submit with my requested pool changes.

Thanks!

@brianc
Copy link
Owner

@brianc brianc commented Mar 25, 2020

@chriskchew
Copy link
Contributor Author

@chriskchew chriskchew commented Mar 26, 2020

Thanks for your response. I'll keep playing with it, but this is what I get so far when I follow those steps:

Laptop:node-postgres user$ yarn test
yarn run v1.21.1
$ yarn lerna exec yarn test
$ /Users/user/work/node-postgres/node_modules/.bin/lerna exec yarn test
lerna notice cli v3.19.0
lerna info versioning independent
lerna info Executing command in 5 packages: "yarn test"
$ tsc
$  node_modules/.bin/mocha


  Bring your own promise
    1) uses supplied promise for operations

  0 passing (31ms)
  1 failing

  1) Bring your own promise
       uses supplied promise for operations:
     TypeError: Cannot read property 'release' of undefined
      at Context.<anonymous> (test/bring-your-own-promise.js:20:13)
      at Generator.next (<anonymous>)
      at onFulfilled (/Users/user/work/node-postgres/node_modules/co/index.js:65:19)
      at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:504:31)
      at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:561:18)
      at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:606:10)
      at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:685:18)
      at Async._drainQueue (node_modules/bluebird/js/release/async.js:138:16)
      at Async._drainQueues (node_modules/bluebird/js/release/async.js:148:10)
      at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14)




error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn test exited 1 in 'pg-pool'
lerna ERR! yarn test exited 1 in 'pg-pool'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@chriskchew
Copy link
Contributor Author

@chriskchew chriskchew commented Mar 26, 2020

I figured it out!

Here are the steps I went through:

  1. clone the repo
  2. Run yarn && yarn lerna bootstrap (I'm not a lerna user so that second command would have taken me a while to figure out)
  3. At this point yarn test would fail with the error I posted above earlier today. After some monkeying around with console.log statements in pg-pool's bring-your-own-promise.js test, I realized I didn't have my postgresql instance running...and then didn't have a database initialized. I'm not sure the purpose of the promise.catch(e => undefined) rejection handler, but it definitely obfuscated my user errors...any objection to me grooming that a bit to provide better messaging?
  4. Now most of the tests pass, except for the ones that require SSL. My local postgres instance installed via Homebrew did not have it enabled, so I did that setup
  5. Tests pass!

So I think the official steps are:

  1. Clone the repo
  2. From the workspace root run yarn and then yarn lerna bootstrap
  3. Make sure you have a database instance with a database initialized running and accessible according either explicit PG_* envvars set in your shell or implicitly with conventional defaults
  4. Ensure ssl enabled for the postgres instance
  5. Run yarn test to ensure everything is in working order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.