Merge pull request #4110 from mempool/knorrium/backend_unit_test_tweaks
Backend unit test tweaks
This commit is contained in:
commit
b03c3745a2
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -47,7 +47,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Unit Tests
|
- name: Unit Tests
|
||||||
if: ${{ matrix.flavor == 'dev'}}
|
if: ${{ matrix.flavor == 'dev'}}
|
||||||
run: npm run test
|
run: npm run test:ci
|
||||||
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
|
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"reindex-updated-pools": "npm run start-production --update-pools",
|
"reindex-updated-pools": "npm run start-production --update-pools",
|
||||||
"reindex-all-blocks": "npm run start-production --update-pools --reindex-blocks",
|
"reindex-all-blocks": "npm run start-production --update-pools --reindex-blocks",
|
||||||
"test": "./node_modules/.bin/jest --coverage",
|
"test": "./node_modules/.bin/jest --coverage",
|
||||||
|
"test:ci": "CI=true ./node_modules/.bin/jest --coverage",
|
||||||
"lint": "./node_modules/.bin/eslint . --ext .ts",
|
"lint": "./node_modules/.bin/eslint . --ext .ts",
|
||||||
"lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix",
|
"lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix",
|
||||||
"prettier": "./node_modules/.bin/prettier --write \"src/**/*.{js,ts}\"",
|
"prettier": "./node_modules/.bin/prettier --write \"src/**/*.{js,ts}\"",
|
||||||
|
@ -186,7 +186,9 @@ describe('Mempool Backend Config', () => {
|
|||||||
for (const [key, value] of Object.entries(jsonObj)) {
|
for (const [key, value] of Object.entries(jsonObj)) {
|
||||||
// We have a few cases where we can't follow the pattern
|
// We have a few cases where we can't follow the pattern
|
||||||
if (root === 'MEMPOOL' && key === 'HTTP_PORT') {
|
if (root === 'MEMPOOL' && key === 'HTTP_PORT') {
|
||||||
console.log('skipping check for MEMPOOL_HTTP_PORT');
|
if (process.env.CI) {
|
||||||
|
console.log('skipping check for MEMPOOL_HTTP_PORT');
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
@ -208,13 +210,17 @@ describe('Mempool Backend Config', () => {
|
|||||||
//The string used as the default value, to be checked as a regex, i.e, __MEMPOOL_ENABLED__=${MEMPOOL_ENABLED:=(.*)}
|
//The string used as the default value, to be checked as a regex, i.e, __MEMPOOL_ENABLED__=${MEMPOOL_ENABLED:=(.*)}
|
||||||
const defaultEntry = replaceStr + '=' + '\\${' + envVarStr + ':=(.*)' + '}';
|
const defaultEntry = replaceStr + '=' + '\\${' + envVarStr + ':=(.*)' + '}';
|
||||||
|
|
||||||
console.log(`looking for ${defaultEntry} in the start.sh script`);
|
if (process.env.CI) {
|
||||||
|
console.log(`looking for ${defaultEntry} in the start.sh script`);
|
||||||
|
}
|
||||||
const re = new RegExp(defaultEntry);
|
const re = new RegExp(defaultEntry);
|
||||||
expect(startSh).toMatch(re);
|
expect(startSh).toMatch(re);
|
||||||
|
|
||||||
//The string that actually replaces the values in the config file
|
//The string that actually replaces the values in the config file
|
||||||
const sedStr = 'sed -i "s!' + replaceStr + '!${' + replaceStr + '}!g" mempool-config.json';
|
const sedStr = 'sed -i "s!' + replaceStr + '!${' + replaceStr + '}!g" mempool-config.json';
|
||||||
console.log(`looking for ${sedStr} in the start.sh script`);
|
if (process.env.CI) {
|
||||||
|
console.log(`looking for ${sedStr} in the start.sh script`);
|
||||||
|
}
|
||||||
expect(startSh).toContain(sedStr);
|
expect(startSh).toContain(sedStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user