using real couch in integration tests

This commit is contained in:
Martin McKeaveney 2022-09-24 13:17:21 +01:00
parent 2787b5498a
commit e796a86809
6 changed files with 24 additions and 22 deletions

View File

@ -23,6 +23,15 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services:
couchdb:
image: ibmcom/couchdb3
env:
COUCHDB_PASSWORD: budibase
COUCHDB_USER: budibase
ports:
- 4567:5984
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [14.x]
@ -53,13 +62,6 @@ jobs:
name: codecov-umbrella name: codecov-umbrella
verbose: true verbose: true
# TODO: parallelise this
- name: Cypress run
uses: cypress-io/github-action@v2
with:
install: false
command: yarn test:e2e:ci
- name: QA Core Integration Tests - name: QA Core Integration Tests
run: | run: |
cd qa-core cd qa-core

View File

@ -1,16 +1,14 @@
const cypressConfig = require("../cypress.json") const cypressConfig = require("../cypress.json")
const path = require("path")
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
// normal development system // normal development system
const SERVER_PORT = cypressConfig.env.PORT const SERVER_PORT = cypressConfig.env.PORT
const WORKER_PORT = cypressConfig.env.WORKER_PORT const WORKER_PORT = cypressConfig.env.WORKER_PORT
process.env.NODE_ENV = "cypress" if (!process.env.NODE_ENV) {
process.env.NODE_ENV = "cypress"
}
process.env.ENABLE_ANALYTICS = "0" process.env.ENABLE_ANALYTICS = "0"
process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
process.env.SELF_HOSTED = 1 process.env.SELF_HOSTED = 1
process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/` process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/`
process.env.APPS_URL = `http://localhost:${SERVER_PORT}/` process.env.APPS_URL = `http://localhost:${SERVER_PORT}/`

View File

@ -1,5 +1,5 @@
const core = require("@budibase/backend-core") const core = require("@budibase/backend-core")
const env = require("../environment") // const env = require("../environment")
exports.init = () => { exports.init = () => {
const dbConfig = { const dbConfig = {
@ -7,10 +7,10 @@ exports.init = () => {
find: true, find: true,
} }
if (env.isTest()) { // if (env.isTest()) {
dbConfig.inMemory = true // dbConfig.inMemory = true
dbConfig.allDbs = true // dbConfig.allDbs = true
} // }
core.init({ db: dbConfig }) core.init({ db: dbConfig })
} }

View File

@ -1,11 +1,11 @@
const core = require("@budibase/backend-core") const core = require("@budibase/backend-core")
const env = require("../environment") // const env = require("../environment")
exports.init = () => { exports.init = () => {
const dbConfig = {} const dbConfig = {}
if (env.isTest()) { // if (env.isTest()) {
dbConfig.inMemory = true // dbConfig.inMemory = true
dbConfig.allDbs = true // dbConfig.allDbs = true
} // }
core.init({ db: dbConfig }) core.init({ db: dbConfig })
} }

View File

@ -1,3 +1,4 @@
BB_ADMIN_USER_EMAIL=qa@budibase.com BB_ADMIN_USER_EMAIL=qa@budibase.com
BB_ADMIN_USER_PASSWORD=budibase BB_ADMIN_USER_PASSWORD=budibase
ENCRYPTED_TEST_PUBLIC_API_KEY=a65722f06bee5caeadc5d7ca2f543a43-d610e627344210c643bb726f ENCRYPTED_TEST_PUBLIC_API_KEY=a65722f06bee5caeadc5d7ca2f543a43-d610e627344210c643bb726f
COUCH_DB_URL=http://budibase:budibase@localhost:4567

View File

@ -41,6 +41,7 @@ describe("Public API - /rows endpoints", () => {
}, },
}) })
expect(response).toHaveStatusCode(200) expect(response).toHaveStatusCode(200)
expect(rows.length).toEqual(1)
expect(rows[0]._id).toEqual(config.context._id) expect(rows[0]._id).toEqual(config.context._id)
expect(rows[0].tableId).toEqual(config.context.tableId) expect(rows[0].tableId).toEqual(config.context.tableId)
expect(rows[0].testColumn).toEqual(config.context.testColumn) expect(rows[0].testColumn).toEqual(config.context.testColumn)