chrisguttandin / dynamo-db-local

A wrapper around Amazon's DynamoDB Local to start and stop it from Node.js.
MIT License
13 stars 5 forks source link

feat(config): add option to run in background #116

Closed o-alexandrov closed 1 year ago

o-alexandrov commented 1 year ago

Node.js docs describe how to spawn in a detached way

chrisguttandin commented 1 year ago

Thanks a lot for adding this. Sorry, that it took me so long to finally take a look at your PR.

mxro commented 1 year ago

Thanks for this 🥳 I still have problems running this with the windows-latest GitHub runner.

Here the test: https://github.com/mxro/dynamodb-local-stop/blob/master/index.test.js

And here the output from the job on GitHub Actions:

Run npm test

> dynamodb-local-stop@1.0.0 test
> cross-env NODE_OPTIONS=--dns-result-order=ipv4first jest

  console.log
    Containers before start

      at Object.log (index.test.js:15:11)

  console.log
    CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

      at Object.log (index.test.js:16:11)

  console.log
    DynamoDB Local process started. Waiting for Docker container to spin up ...

      at Object.log (index.test.js:19:11)

  console.log
    Containers after start

      at Object.log (index.test.js:23:11)

  console.log
    CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

      at Object.log (index.test.js:24:11)

FAIL ./index.test.js (240.809 s)
  × Should start and stop DynamoDB Local (240013 ms)

  ● Should start and stop DynamoDB Local

    thrown: "Exceeded timeout of 240000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      11 | }
      12 |
    > 13 | it('Should start and stop DynamoDB Local', async () => {
         | ^
      14 |
      15 |   console.log('Containers before start');
      16 |   console.log(execSync('docker container ls').toString());

      at Object.it (index.test.js:13:1)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        240.912 s
Ran all test suites.
Error: Process completed with exit code 1.

Seems like it never completes the spawn command. Using ubuntu-latest works without problems!

o-alexandrov commented 1 year ago

@mxro apologies, I don't use Windows and none of my clients do, so I won't be able to help. I'll keep an eye here for comments to which I'd be able to reply