Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallel: false doesn't work #30

Open
kuznetsss opened this issue Nov 19, 2024 · 0 comments
Open

parallel: false doesn't work #30

kuznetsss opened this issue Nov 19, 2024 · 0 comments

Comments

@kuznetsss
Copy link

Hi, thanks for the action!

It seems parallel: false option doesn't work, even if it is provided, tests are still executed in parallel.

I created a simple repository to reproduce the issue: https://github.com/kuznetsss/k6_parallel_test.

The code looks the same for both branches in

run-k6-action/src/index.ts

Lines 90 to 148 in a784f35

if (parallel) {
const childProcesses = [] as any[];
commands.forEach(command => {
const child = runCommand(command);
childProcesses.push(child);
TEST_PIDS.push(child.pid);
allPromises.push(new Promise(resolve => {
child.on('exit', (code: number, signal: string) => {
const index = TEST_PIDS.indexOf(child.pid);
if (index > -1) {
TEST_PIDS.splice(index, 1);
}
if (code !== 0) {
if (failFast) {
console.log('🚨 Fail fast enabled. Stopping further tests.');
childProcesses.forEach(child => {
if (!child.killed) {
child.kill('SIGINT');
}
});
process.exit(1); // Exit parent process with failure status
} else {
console.log(`🚨 Test failed with code: ${code} and signal: ${signal}`);
allTestsPassed = false;
}
} else {
console.log('✅ Test passed');
}
resolve();
});
}));
});
} else {
for (const command of commands) {
const child = runCommand(command);
TEST_PIDS.push(child.pid);
allPromises.push(new Promise<void>(resolve => {
child.on('exit', (code: number, signal: string) => {
const index = TEST_PIDS.indexOf(child.pid);
if (index > -1) {
TEST_PIDS.splice(index, 1);
}
if (code !== 0) {
if (failFast) {
console.log('🚨 Fail fast enabled. Stopping further tests.');
process.exit(1); // Exit parent process with failure status
} else {
console.log(`🚨 Test failed with code: ${code} and signal: ${signal}`);
allTestsPassed = false;
}
} else {
console.log('✅ Test passed');
}
resolve();
});
}));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant