MongoDB Transactions (#12335)

* add run-rs to dependencies

* wip: add replica set to api unit github action

* wip: add replica set to api unit github action

* wip: fix gh actions mongodb replica set setting

* usa replica set for integration tests

* add correct mongodb version matrix for integration tests

* use different db connection on gh actions

* Revert "use different db connection on gh actions"

This reverts commit aa8db759d3.

* add example transaction

* add mongo script to package.json

* abstract mongodb utils, connect using hostname on windows

* npm scripts: mongo -> mongo:dev

* add setup script for run-rs on windows

* gh actions: run in test environment

* remove test files

* better error handling, use cross-spawn to avoid issues on windows

* fix lint
This commit is contained in:
Matteo Pagliazzi
2020-07-14 18:55:47 +02:00
committed by GitHub
parent e89ff95a21
commit c93bf3e498
11 changed files with 1432 additions and 864 deletions
+27 -3
View File
@@ -22,6 +22,7 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run lint-no-fix
apidoc:
runs-on: ubuntu-latest
@@ -42,6 +43,7 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run apidoc
sanity:
runs-on: ubuntu-latest
@@ -62,6 +64,7 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:sanity
common:
@@ -83,6 +86,7 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:common
content:
runs-on: ubuntu-latest
@@ -103,6 +107,7 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:content
api-unit:
@@ -110,6 +115,7 @@ jobs:
strategy:
matrix:
node-version: [12.x]
mongodb-version: [4.2]
steps:
- uses: actions/checkout@v1
with:
@@ -118,13 +124,18 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set
uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: rs
- run: cp config.json.example config.json
- name: npm install
run: |
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:api:unit
env:
REQUIRES_SERVER=true: true
@@ -133,6 +144,7 @@ jobs:
strategy:
matrix:
node-version: [12.x]
mongodb-version: [4.2]
steps:
- uses: actions/checkout@v1
with:
@@ -141,13 +153,18 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set
uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: rs
- run: cp config.json.example config.json
- name: npm install
run: |
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:api-v3:integration
env:
REQUIRES_SERVER=true: true
@@ -156,6 +173,7 @@ jobs:
strategy:
matrix:
node-version: [12.x]
mongodb-version: [4.2]
steps:
- uses: actions/checkout@v1
with:
@@ -164,13 +182,18 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: sudo docker run --name mongo -d -p 27017:27017 mongo:4.2
- name: Start MongoDB ${{ matrix.mongodb-version }} Replica Set
uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: rs
- run: cp config.json.example config.json
- name: npm install
run: |
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:api-v4:integration
env:
REQUIRES_SERVER=true: true
@@ -194,5 +217,6 @@ jobs:
npm ci
env:
CI: true
NODE_ENV: test
- run: npm run test:unit
working-directory: ./website/client