v1.12.27 NAS 실행 yaml 및 명시적 이미지 빌드 분리
This commit is contained in:
@@ -23,10 +23,43 @@ for (const script of ['migrate-production-db.sh', 'backfill-post-thumbnails-prod
|
||||
const calls = readFileSync(logPath, 'utf8').trim().split('\n')
|
||||
assert.ok(calls.length > 0)
|
||||
for (const call of calls) {
|
||||
assert.ok(call.startsWith(`<compose><-f><${join(root, 'docker-compose.yml')}><--env-file><${relative(root, envPath)}>`))
|
||||
assert.ok(call.startsWith(`<compose><-f><${join(root, 'docker-compose.yaml')}><--env-file><${relative(root, envPath)}>`))
|
||||
}
|
||||
} finally {
|
||||
rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
for (const exitCode of [0, 19]) {
|
||||
test(`운영 이미지 빌드는 컨테이너 변경 없이 build만 실행하고 종료 코드 ${exitCode}를 전달한다`, () => {
|
||||
const directory = mkdtempSync(join(tmpdir(), 'sori-image-build-test-'))
|
||||
try {
|
||||
const logPath = join(directory, 'docker.log')
|
||||
const envPath = join(directory, 'production.env')
|
||||
writeFileSync(envPath, 'COMPOSE_PROJECT_NAME=sori-studio\n')
|
||||
writeFileSync(join(directory, 'docker'), `#!/bin/sh\nprintf "<%s>" "$@" > "$SORI_TEST_DOCKER_LOG"\nexit ${exitCode}\n`, { mode: 0o755 })
|
||||
const result = spawnSync('sh', ['scripts/build-production-image.sh'], {
|
||||
cwd: root, encoding: 'utf8',
|
||||
env: { ...process.env, PATH: `${directory}:${process.env.PATH}`, ENV_FILE: envPath, SORI_TEST_DOCKER_LOG: logPath, APP_SERVICE: 'sori-studio' }
|
||||
})
|
||||
assert.equal(result.status, exitCode, result.stderr)
|
||||
assert.equal(readFileSync(logPath, 'utf8'), `<compose><-f><${join(root, 'docker-compose.build.yml')}><--env-file><${envPath}><build><sori-studio>`)
|
||||
} finally {
|
||||
rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
test('운영 이미지 빌드는 읽을 수 없는 환경 파일을 거부한다', () => {
|
||||
const directory = mkdtempSync(join(tmpdir(), 'sori-image-build-test-'))
|
||||
try {
|
||||
const result = spawnSync('sh', ['scripts/build-production-image.sh'], {
|
||||
cwd: root, encoding: 'utf8', env: { ...process.env, ENV_FILE: join(directory, 'missing.env') }
|
||||
})
|
||||
assert.equal(result.status, 1)
|
||||
assert.match(result.stderr, /환경 파일을 읽을 수 없습니다/)
|
||||
} finally {
|
||||
rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user