From e796a868090413f9dc9cbd5fd58487699ab5b5b1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Sat, 24 Sep 2022 13:17:21 +0100 Subject: [PATCH] using real couch in integration tests --- .github/workflows/budibase_ci.yml | 16 +++++++++------- packages/builder/cypress/setup.js | 8 +++----- packages/server/src/db/index.js | 10 +++++----- packages/worker/src/db/index.js | 10 +++++----- qa-core/.env | 1 + qa-core/src/tests/public-api/tables/rows.spec.ts | 1 + 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 42a0c0a273..06a21c5348 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -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 diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js index d858801990..0e2f25b028 100644 --- a/packages/builder/cypress/setup.js +++ b/packages/builder/cypress/setup.js @@ -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 -process.env.NODE_ENV = "cypress" +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}/` diff --git a/packages/server/src/db/index.js b/packages/server/src/db/index.js index 75ad19b87f..e8ec2c720e 100644 --- a/packages/server/src/db/index.js +++ b/packages/server/src/db/index.js @@ -1,5 +1,5 @@ const core = require("@budibase/backend-core") -const env = require("../environment") +// const env = require("../environment") exports.init = () => { const dbConfig = { @@ -7,10 +7,10 @@ exports.init = () => { find: true, } - if (env.isTest()) { - dbConfig.inMemory = true - dbConfig.allDbs = true - } + // if (env.isTest()) { + // dbConfig.inMemory = true + // dbConfig.allDbs = true + // } core.init({ db: dbConfig }) } diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index 25dc02962b..bdfc55a22a 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -1,11 +1,11 @@ const core = require("@budibase/backend-core") -const env = require("../environment") +// const env = require("../environment") exports.init = () => { const dbConfig = {} - if (env.isTest()) { - dbConfig.inMemory = true - dbConfig.allDbs = true - } + // if (env.isTest()) { + // dbConfig.inMemory = true + // dbConfig.allDbs = true + // } core.init({ db: dbConfig }) } diff --git a/qa-core/.env b/qa-core/.env index 740b1b2b2a..7f39785f33 100644 --- a/qa-core/.env +++ b/qa-core/.env @@ -1,3 +1,4 @@ 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 \ No newline at end of file diff --git a/qa-core/src/tests/public-api/tables/rows.spec.ts b/qa-core/src/tests/public-api/tables/rows.spec.ts index 91df85e65c..89149159ab 100644 --- a/qa-core/src/tests/public-api/tables/rows.spec.ts +++ b/qa-core/src/tests/public-api/tables/rows.spec.ts @@ -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)