supercharge / mongodb-github-action

Use MongoDB in GitHub Actions
MIT License
224 stars 46 forks source link

[Bug?] [Mongoose/Mocha] Not connecting to database #10

Closed piotrryczek closed 4 years ago

piotrryczek commented 4 years ago

Hello, I've spent couple (4-5) hours trying to make it works but it looks like it is something above me.

Error: UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

Getting error for any settings configuration.

Here is repo: https://github.com/piotrryczek/test-actions

Actions: https://github.com/piotrryczek/test-actions/actions

Workflow: https://github.com/piotrryczek/test-actions/blob/master/.github/workflows/main.yml

Here is sample test: https://github.com/piotrryczek/test-actions/blob/master/src/models/___tests__/sample.test.ts

As you see I tried both via app and via mongoose standalone connection. Env is correctly being injected.

Before also trying with Jest. Locally tests are working correctly. It is definetly problem with mongoose connection to mongo database.

Thank you in advance!

piotrryczek commented 4 years ago

Didn't set a replica in mongoose connection settings...

marcuspoehls commented 4 years ago

@piotrryczek Hey Piotr, good to hear you already found the issue!