Merge pull request #7964 from Budibase/qa/real-couch-integration-tests

This commit is contained in:
Martin McKeaveney 2022-09-26 11:10:15 +01:00 committed by GitHub
commit 1a18e7eba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 15 deletions

View File

@ -23,6 +23,15 @@ jobs:
build:
runs-on: ubuntu-latest
services:
couchdb:
image: ibmcom/couchdb3
env:
COUCHDB_PASSWORD: budibase
COUCHDB_USER: budibase
ports:
- 4567:5984
strategy:
matrix:
node-version: [14.x]
@ -53,13 +62,6 @@ jobs:
name: codecov-umbrella
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
run: |
cd qa-core

View File

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

View File

@ -7,7 +7,7 @@ exports.init = () => {
find: true,
}
if (env.isTest()) {
if (env.isTest() && !env.COUCH_DB_URL) {
dbConfig.inMemory = true
dbConfig.allDbs = true
}

View File

@ -3,7 +3,7 @@ const env = require("../environment")
exports.init = () => {
const dbConfig = {}
if (env.isTest()) {
if (env.isTest() && !env.COUCH_DB_URL) {
dbConfig.inMemory = true
dbConfig.allDbs = true
}

View File

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

View File

@ -0,0 +1,12 @@
version: "3.8"
services:
qa-core-couchdb:
# platform: linux/amd64
container_name: budi-couchdb-qa
restart: on-failure
image: ibmcom/couchdb3
environment:
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD}
- COUCHDB_USER=${COUCH_DB_USER}
ports:
- "4567:5984"

View File

@ -12,7 +12,9 @@
"test": "jest --runInBand",
"test:watch": "jest --watch",
"test:debug": "DEBUG=1 jest",
"api:server:setup": "env-cmd ts-node ../packages/builder/cypress/ts/setup.ts",
"docker:up": "docker-compose up -d",
"docker:down": "docker-compose down",
"api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/cypress/ts/setup.ts",
"api:server:setup:ci": "env-cmd node ../packages/builder/cypress/setup.js",
"api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test",
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test"

View File

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