Skip to content

Commit a97c048

Browse files
committed
cluster: add test for cluster.setPrimary({schedulingPolicy})
1 parent 71f456c commit a97c048

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Refs: https://github.com/nodejs/node/issues/49240
2+
// When importing cluster in ESM, cluster.schedulingPolicy cannot be set;
3+
// and the env variable doesn't work since imports are hoisted to the top.
4+
import '../common/index.mjs';
5+
import assert from 'node:assert';
6+
import * as cluster from 'cluster';
7+
8+
9+
assert.strictEqual(cluster.schedulingPolicy, cluster.SCHED_RR);
10+
cluster.setupPrimary({ schedulingPolicy: cluster.SCHED_NONE });
11+
const settings = cluster.getSettings();
12+
assert.strictEqual(settings.schedulingPolicy, cluster.SCHED_NONE);

0 commit comments

Comments
 (0)