Skip to content

Commit

Permalink
more clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Jul 9, 2024
1 parent c065b78 commit c22e98e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/e2e/.mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
fullTrace: true,
asyncOnly: false,
spec: ['test/e2e/**/*.spec.js'],
timeout: 200 * 1000, //API takes a little long to start up
timeout: 60_000, // API takes a little long to start up
reporter: 'spec',
file: ['test/e2e/hooks.js'],
captureFile: 'test/e2e/results.txt',
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/cht-docker-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const https = require('https');
const { spawn } = require('child_process');
const request = require('request-promise-native');

const log = require('../../src/lib/log');

const DEFAULT_PROJECT_NAME = 'cht_conf_e2e_tests';
const dockerHelperDirectory = path.resolve(__dirname, '.cht-docker-helper');
const dockerHelperScript = path.resolve(dockerHelperDirectory, './cht-docker-compose.sh');
Expand Down Expand Up @@ -45,7 +47,7 @@ const getProjectConfig = async (projectName) => {
.filter(entry => entry.length === 2),
);
} catch (error) {
console.error(error);
log.error(error);
return {
COUCHDB_USER: 'medic',
COUCHDB_PASSWORD: 'password',
Expand All @@ -61,7 +63,7 @@ const getProjectUrl = async (projectName = DEFAULT_PROJECT_NAME) => {
};

const isProjectReady = async (projectName, attempt = 1) => {
console.log(`Checking if CHT is ready, attempt ${attempt}.`);
log.info(`Checking if CHT is ready, attempt ${attempt}.`);
const url = await getProjectUrl(projectName);
await request({ uri: `${url}/api/v2/monitoring`, json: true })
.catch(async (error) => {
Expand Down Expand Up @@ -125,6 +127,7 @@ const tearDownCht = async (projectName = DEFAULT_PROJECT_NAME) => {
};

module.exports = {
DEFAULT_PROJECT_NAME,
getProjectUrl,
spinUpCht,
tearDownCht,
Expand Down
10 changes: 8 additions & 2 deletions test/e2e/edit-app-settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ const path = require('path');
const { expect } = require('chai');
const request = require('request-promise-native');

const { cleanupProject, getProjectDirectory, initProject, runChtConf } = require('./cht-conf-utils');
const { getProjectUrl } = require('./cht-docker-utils');
const {
DEFAULT_PROJECT_NAME,
cleanupProject,
getProjectDirectory,
initProject,
runChtConf,
} = require('./cht-conf-utils');

describe('edit-app-settings', () => {
const projectName = 'e2e-edit-app-settings';
const projectName = DEFAULT_PROJECT_NAME;
const projectDirectory = getProjectDirectory(projectName);

before(async () => {
Expand Down

0 comments on commit c22e98e

Please sign in to comment.