@deploystack/docker-to-iac
Version:
Translate docker run and docker compose file to Infrastructure as Code
62 lines (61 loc) • 2.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const test1_1 = require("./test1");
const test2_1 = require("./test2");
const test3_1 = require("./test3");
const test4_1 = require("./test4");
const test5_1 = require("./test5");
const test6_1 = require("./test6");
// Constants for directories
const OUTPUT_DIR = (0, path_1.join)(__dirname, 'output');
// Create output directory if it doesn't exist
if (!(0, fs_1.existsSync)(OUTPUT_DIR)) {
(0, fs_1.mkdirSync)(OUTPUT_DIR, { recursive: true });
}
const testResults = [];
/**
* Run all end-to-end tests
*/
async function runAllTests() {
console.log('=== Starting E2E Tests ===');
// Run Test 1: Environment variables and volume mapping
const test1Passed = await (0, test1_1.runTest1)();
testResults.push({ testName: 'Test 1: Environment Variables and Volume Mapping', passed: test1Passed });
// Run Test 2: Port Mappings
const test2Passed = await (0, test2_1.runTest2)();
testResults.push({ testName: 'Test 2: Port Mappings', passed: test2Passed });
// Run Test 3: Environment Variable Substitution
const test3Passed = await (0, test3_1.runTest3)();
testResults.push({ testName: 'Test 3: Environment Variable Substitution', passed: test3Passed });
// Run Test 4: Render Translation Only (Schema validation)
const test4Passed = await (0, test4_1.runTest4)();
testResults.push({ testName: 'Test 4: Render Translation Only', passed: test4Passed });
// Run Test 5: Portkey Gateway Port and Image Verification
const test5Passed = await (0, test5_1.runTest5)();
testResults.push({ testName: 'Test 5: Portkey Gateway Port and Image Verification', passed: test5Passed });
// Run Test 6: Helm Chart Linting
const test6Passed = await (0, test6_1.runTest6)();
testResults.push({ testName: 'Test 6: Helm Chart Linting', passed: test6Passed });
// Print summary
console.log('\n=== Test Summary ===');
const passedTests = testResults.filter(r => r.passed);
console.log(`Total tests: ${testResults.length}`);
console.log(`Passed: ${passedTests.length}`);
console.log(`Failed: ${testResults.length - passedTests.length}`);
// Print failed tests
if (testResults.length - passedTests.length > 0) {
console.log('\nFailed Tests:');
testResults.filter(r => !r.passed).forEach(test => {
console.log(`- ${test.testName}`);
});
// Exit with error code if any test failed
process.exit(1);
}
}
// Run all tests
runAllTests().catch(error => {
console.error('Test execution failed:', error);
process.exit(1);
});