mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
remove stray redis dependency, and upgrade node in tests (#173)
* remove stray redis dependency in test * tweak handling of database connection between tests * upgrade node versions in tests, type guessing in node 10 has problems
This commit is contained in:
parent
c41c07e4d0
commit
24522e61ff
2
.github/workflows/docker_latest.yml
vendored
2
.github/workflows/docker_latest.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [2.7]
|
||||
node-version: [10.x]
|
||||
node-version: [14.x]
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [2.7]
|
||||
node-version: [10.x]
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -12,7 +12,7 @@
|
||||
"install:python3": "buildtools/prepare_python3.sh",
|
||||
"build:prod": "tsc --build && webpack --config buildtools/webpack.config.js --mode production && webpack --config buildtools/webpack.check.js --mode production && cat app/client/*.css app/client/*/*.css > static/bundle.css",
|
||||
"start:prod": "NODE_PATH=_build:_build/stubs node _build/stubs/app/server/server.js",
|
||||
"test": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support NODE_PATH=_build:_build/stubs mocha _build/test/nbrowser/*.js _build/test/server/**/*.js _build/test/gen-server/**/*.js",
|
||||
"test": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support TEST_CLEAN_DATABASE=true NODE_PATH=_build:_build/stubs mocha _build/test/nbrowser/*.js _build/test/server/**/*.js _build/test/gen-server/**/*.js",
|
||||
"test:server": "GRIST_SESSION_COOKIE=grist_test_cookie NODE_PATH=_build:_build/stubs mocha _build/test/server/**/*.js _build/test/gen-server/**/*.js",
|
||||
"test:smoke": "NODE_PATH=_build:_build/stubs mocha _build/test/nbrowser/Smoke.js",
|
||||
"test:docker": "./test/test_under_docker.sh"
|
||||
|
@ -604,8 +604,7 @@ export function setUpDB(context?: IHookCallbackContext) {
|
||||
async function main() {
|
||||
const cmd = process.argv[2];
|
||||
if (cmd === 'init') {
|
||||
const connection = await createConnection();
|
||||
await createInitialDb(connection);
|
||||
await createInitialDb();
|
||||
return;
|
||||
} else if (cmd === 'benchmark') {
|
||||
const connection = await createConnection();
|
||||
|
@ -23,6 +23,7 @@ import {driver, IMochaServer, WebDriver} from 'mocha-webdriver';
|
||||
import fetch from 'node-fetch';
|
||||
import {tmpdir} from 'os';
|
||||
import * as path from 'path';
|
||||
import {removeConnection} from 'test/gen-server/seed';
|
||||
import {HomeUtil} from 'test/nbrowser/homeUtil';
|
||||
|
||||
export class TestServerMerged implements IMochaServer {
|
||||
@ -38,7 +39,7 @@ export class TestServerMerged implements IMochaServer {
|
||||
private _server: ChildProcess;
|
||||
private _exitPromise: Promise<number|string>;
|
||||
private _starts: number = 0;
|
||||
private _dbManager: HomeDBManager;
|
||||
private _dbManager?: HomeDBManager;
|
||||
private _driver: WebDriver;
|
||||
|
||||
// The name is used to name the directory for server logs and data.
|
||||
@ -244,6 +245,11 @@ export class TestServerMerged implements IMochaServer {
|
||||
return this._dbManager;
|
||||
}
|
||||
|
||||
public async closeDatabase() {
|
||||
this._dbManager = undefined;
|
||||
await removeConnection();
|
||||
}
|
||||
|
||||
public get driver() {
|
||||
return this._driver || driver;
|
||||
}
|
||||
|
@ -98,6 +98,10 @@ export function setupTestSuite(options?: TestSuiteOptions) {
|
||||
// always call resume.
|
||||
afterEach(() => server.resume());
|
||||
|
||||
// Close database until next test explicitly needs it, to avoid conflicts
|
||||
// with tests that don't use the same server.
|
||||
after(async () => server.closeDatabase());
|
||||
|
||||
return setupRequirement({team: true, ...options});
|
||||
}
|
||||
|
||||
|
@ -2163,7 +2163,8 @@ function testDocApi() {
|
||||
assert.deepEqual(response.data, {error: `Exceeded daily limit for document ${docId}`});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
after(async function() {
|
||||
if (!process.env.TEST_REDIS_URL) { this.skip(); }
|
||||
await redisClient.quitAsync();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user