smoke tests
Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Failing after 4m17s

This commit is contained in:
2026-01-28 21:39:16 +01:00
parent a85fe64ccb
commit 3f0858a1ba
3 changed files with 59 additions and 1 deletions

36
scripts/smoke-test.ts Normal file
View File

@@ -0,0 +1,36 @@
import * as http from 'http';
/**
* Simple smoke test to verify the application is running and healthy.
* This script is intended to be run against a local or remote instance.
*/
const url = process.argv[2] || 'http://localhost:3000/health';
const timeout = 10000; // 10 seconds
console.log(`🔍 Running smoke test against: ${url}`);
const request = http.get(url, (res) => {
const { statusCode } = res;
if (statusCode === 200) {
console.log('✅ Smoke test passed: Application is healthy.');
process.exit(0);
} else {
console.error(`❌ Smoke test failed: Received status code ${statusCode}`);
process.exit(1);
}
});
request.on('error', (err) => {
console.error(`❌ Smoke test failed: ${err.message}`);
process.exit(1);
});
request.on('timeout', () => {
console.error('❌ Smoke test failed: Request timed out');
request.destroy();
process.exit(1);
});
request.setTimeout(timeout);