55 lines
2.1 KiB
JavaScript
55 lines
2.1 KiB
JavaScript
import assert from 'node:assert/strict';
|
|||
|
|
import { readFileSync } from 'node:fs';
|
||
|
|
import { test } from 'node:test';
|
||
|
|
|
||
|
|
const applicationConfigs = [
|
||
|
|
'auth/src/main/resources/application.yml',
|
||
|
|
'audit-service/src/main/resources/application.yml',
|
||
|
|
'event-bridge-service/src/main/resources/application.yml',
|
||
|
|
'file/src/main/resources/application.yml',
|
||
|
|
'finance/src/main/resources/application.yml',
|
||
|
|
'firstleg/src/main/resources/application.yml',
|
||
|
|
'gateway/src/main/resources/application.yml',
|
||
|
|
'gateway-overseas/src/main/resources/application.yml',
|
||
|
|
'iam/src/main/resources/application.yml',
|
||
|
|
'integration-service/src/main/resources/application.yml',
|
||
|
|
'lastleg-service/src/main/resources/application.yml',
|
||
|
|
'order/src/main/resources/application.yml',
|
||
|
|
'print/src/main/resources/application.yml',
|
||
|
|
'warehouse/src/main/resources/application.yml',
|
||
|
|
'warehouse-overseas-service/src/main/resources/application.yml',
|
||
|
|
'config/nacos/cn/baiyue-common.yml',
|
||
|
|
'config/nacos/local/baiyue-common.yml',
|
||
|
|
'config/nacos/overseas/baiyue-common.yml',
|
||
|
|
];
|
||
|
|
|
||
|
|
const composeFiles = [
|
||
|
|
'deploy/docker-compose.yml',
|
||
|
|
'deploy/docker-compose.overseas.yml',
|
||
|
|
];
|
||
|
|
|
||
|
|
test('deployable applications log only to stdout and stderr', () => {
|
||
|
|
for (const path of applicationConfigs) {
|
||
|
|
const source = readFileSync(path, 'utf8');
|
||
|
|
assert.doesNotMatch(source, /LOG_PATH|LOGGING_FILE_NAME|LOGGING_ROLLING/, path);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
test('Compose uses one bounded local log stream without application log mounts', () => {
|
||
|
|
for (const path of composeFiles) {
|
||
|
|
const source = readFileSync(path, 'utf8');
|
||
|
|
assert.match(source, /driver:\s+local/, path);
|
||
|
|
assert.match(source, /DOCKER_LOG_MAX_SIZE/, path);
|
||
|
|
assert.match(source, /DOCKER_LOG_MAX_FILE/, path);
|
||
|
|
assert.doesNotMatch(source, /LOG_PATH|LOG_ROOT|\/app\/logs/, path);
|
||
|
|
}
|
||
|
|
|
||
|
|
const domesticCompose = readFileSync(composeFiles[0], 'utf8');
|
||
|
|
assert.match(domesticCompose, /FILE_UPLOADS_HOST_DIR[^\n]+:\/data\/files/);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('runtime image does not prepare an application log directory', () => {
|
||
|
|
const dockerfile = readFileSync('deploy/docker/Dockerfile', 'utf8');
|
||
|
|
assert.doesNotMatch(dockerfile, /\/app\/logs/);
|
||
|
|
});
|