Skip to content

Commit 51cd6ff

Browse files
remove public config setting
1 parent 57b2cc2 commit 51cd6ff

File tree

10 files changed

+41
-37
lines changed

10 files changed

+41
-37
lines changed

packages/core-bridge/src/worker.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ mod config {
507507
max_activities_per_second: Option<f64>,
508508
max_task_queue_activities_per_second: Option<f64>,
509509
shutdown_grace_time: Option<Duration>,
510-
skip_client_worker_set_check: bool,
511510
}
512511

513512
#[derive(TryFromJs)]
@@ -575,7 +574,6 @@ mod config {
575574
.max_task_queue_activities_per_second(self.max_task_queue_activities_per_second)
576575
.max_worker_activities_per_second(self.max_activities_per_second)
577576
.graceful_shutdown_period(self.shutdown_grace_time)
578-
.skip_client_worker_set_check(self.skip_client_worker_set_check)
579577
.build()
580578
}
581579
}

packages/core-bridge/ts/native.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ export interface WorkerOptions {
221221
maxTaskQueueActivitiesPerSecond: Option<number>;
222222
maxActivitiesPerSecond: Option<number>;
223223
shutdownGraceTime: number;
224-
skipClientWorkerSetCheck: boolean;
225224
}
226225

227226
export type PollerBehavior =

packages/test/src/helpers-integration.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
DefaultLogger,
1818
LogEntry,
1919
LogLevel,
20+
NativeConnection,
21+
NativeConnectionOptions,
2022
ReplayWorkerOptions,
2123
Runtime,
2224
RuntimeOptions,
@@ -184,6 +186,7 @@ export async function createTestWorkflowEnvironment(
184186
export interface Helpers {
185187
taskQueue: string;
186188
createWorker(opts?: Partial<WorkerOptions>): Promise<Worker>;
189+
createNativeConnection(opts?: Partial<NativeConnectionOptions>): Promise<NativeConnection>;
187190
runReplayHistory(opts: Partial<ReplayWorkerOptions>, history: temporal.api.history.v1.IHistory): Promise<void>;
188191
executeWorkflow<T extends () => Promise<any>>(workflowType: T): Promise<workflow.WorkflowResultType<T>>;
189192
executeWorkflow<T extends workflow.Workflow>(
@@ -218,6 +221,9 @@ export function configurableHelpers<T>(
218221
...opts,
219222
});
220223
},
224+
async createNativeConnection(opts?: Partial<NativeConnectionOptions>): Promise<NativeConnection> {
225+
return await NativeConnection.connect({ address: testEnv.address, ...opts });
226+
},
221227
async runReplayHistory(
222228
opts: Partial<ReplayWorkerOptions>,
223229
history: temporal.api.history.v1.IHistory

packages/test/src/test-bridge.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ const GenericConfigs = {
306306
maxTaskQueueActivitiesPerSecond: null,
307307
maxActivitiesPerSecond: null,
308308
shutdownGraceTime: 1000,
309-
skipClientWorkerSetCheck: true,
310309
} satisfies native.WorkerOptions,
311310
},
312311
ephemeralServer: {

packages/test/src/test-integration-workflows.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export async function executeEagerActivity(): Promise<void> {
445445
}
446446

447447
test('Worker requests Eager Activity Dispatch if possible', async (t) => {
448-
const { createWorker, startWorkflow } = helpers(t);
448+
const { createWorker, startWorkflow, createNativeConnection } = helpers(t);
449449

450450
// If eager activity dispatch is working, then the task will always be dispatched to the workflow
451451
// worker. Otherwise, chances are 50%-50% for either workers. The test workflow schedule the
@@ -459,11 +459,15 @@ test('Worker requests Eager Activity Dispatch if possible', async (t) => {
459459
// Override the default workflow bundle, to make this an activity-only worker
460460
workflowBundle: undefined,
461461
});
462+
const workflowWorkerConnection = await createNativeConnection();
463+
t.teardown(() => {
464+
workflowWorkerConnection.close();
465+
});
462466
const workflowWorker = await createWorker({
467+
connection: workflowWorkerConnection,
463468
activities: {
464469
testActivity: () => 'workflow-and-activity-worker',
465470
},
466-
skipClientWorkerSetCheck: true,
467471
});
468472
const handle = await startWorkflow(executeEagerActivity);
469473
await activityWorker.runUntil(workflowWorker.runUntil(handle.result()));
@@ -483,7 +487,7 @@ export async function dontExecuteEagerActivity(): Promise<string> {
483487
}
484488

485489
test("Worker doesn't request Eager Activity Dispatch if no activities are registered", async (t) => {
486-
const { createWorker, startWorkflow } = helpers(t);
490+
const { createNativeConnection, createWorker, startWorkflow } = helpers(t);
487491

488492
// If the activity was eagerly dispatched to the Workflow worker even though it is a Workflow-only
489493
// worker, then the activity execution will timeout (because tasks are not being polled) or
@@ -498,9 +502,11 @@ test("Worker doesn't request Eager Activity Dispatch if no activities are regist
498502
// Override the default workflow bundle, to make this an activity-only worker
499503
workflowBundle: undefined,
500504
});
505+
const workflowWorkerConnection = await createNativeConnection();
506+
t.teardown(() => workflowWorkerConnection.close());
501507
const workflowWorker = await createWorker({
508+
connection: workflowWorkerConnection,
502509
activities: {},
503-
skipClientWorkerSetCheck: true,
504510
});
505511
const handle = await startWorkflow(dontExecuteEagerActivity);
506512
const result = await activityWorker.runUntil(workflowWorker.runUntil(handle.result()));

packages/test/src/test-sinks.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ if (RUN_INTEGRATION_TESTS) {
261261
sinks,
262262
maxCachedWorkflows: 0,
263263
maxConcurrentWorkflowTaskExecutions: 2,
264-
skipClientWorkerSetCheck: true,
265264
});
266265
const client = new WorkflowClient();
267266
await worker.runUntil(client.execute(workflows.logSinkTester, { taskQueue, workflowId: uuid4() }));
@@ -308,7 +307,6 @@ if (RUN_INTEGRATION_TESTS) {
308307
...defaultOptions,
309308
taskQueue,
310309
sinks,
311-
skipClientWorkerSetCheck: true,
312310
});
313311
const workflowId = uuid4();
314312
await worker.runUntil(client.execute(workflows.logSinkTester, { taskQueue, workflowId }));
@@ -322,7 +320,6 @@ if (RUN_INTEGRATION_TESTS) {
322320
{
323321
...defaultOptions,
324322
sinks,
325-
skipClientWorkerSetCheck: true,
326323
},
327324
history,
328325
workflowId
@@ -354,7 +351,6 @@ if (RUN_INTEGRATION_TESTS) {
354351
...defaultOptions,
355352
taskQueue,
356353
sinks,
357-
skipClientWorkerSetCheck: true,
358354
});
359355
const client = new WorkflowClient();
360356
const workflowId = uuid4();
@@ -371,7 +367,6 @@ if (RUN_INTEGRATION_TESTS) {
371367
{
372368
...defaultOptions,
373369
sinks,
374-
skipClientWorkerSetCheck: true,
375370
},
376371
history,
377372
workflowId
@@ -416,7 +411,6 @@ if (RUN_INTEGRATION_TESTS) {
416411
...defaultOptions,
417412
taskQueue,
418413
sinks,
419-
skipClientWorkerSetCheck: true,
420414
});
421415
await worker.runUntil(
422416
client.execute(workflows.upsertAndReadSearchAttributes, {

packages/test/src/test-worker-deployment-versioning.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Client } from '@temporalio/client';
1111
import { toCanonicalString, WorkerDeploymentVersion } from '@temporalio/common';
1212
import { temporal } from '@temporalio/proto';
1313
import { Worker } from './helpers';
14-
import { Context, makeTestFunction } from './helpers-integration';
14+
import { Context, helpers, makeTestFunction } from './helpers-integration';
1515
import { unblockSignal, versionQuery } from './workflows';
1616

1717
const test = makeTestFunction({ workflowsPath: __filename });
@@ -20,6 +20,7 @@ test('Worker deployment based versioning', async (t) => {
2020
const taskQueue = 'worker-deployment-based-versioning-' + randomUUID();
2121
const deploymentName = 'deployment-' + randomUUID();
2222
const { client, nativeConnection } = t.context.env;
23+
const { createNativeConnection } = helpers(t);
2324

2425
const w1DeploymentVersion = {
2526
buildId: '1.0',
@@ -43,13 +44,14 @@ test('Worker deployment based versioning', async (t) => {
4344
defaultVersioningBehavior: 'PINNED',
4445
},
4546
connection: nativeConnection,
46-
skipClientWorkerSetCheck: true,
4747
});
4848
const worker1Promise = worker1.run();
4949
worker1Promise.catch((err) => {
5050
t.fail('Worker 1.0 run error: ' + err);
5151
});
5252

53+
const worker2Connection = await createNativeConnection();
54+
t.teardown(() => worker2Connection.close());
5355
const worker2 = await Worker.create({
5456
workflowsPath: require.resolve('./deployment-versioning-v2'),
5557
taskQueue,
@@ -58,14 +60,15 @@ test('Worker deployment based versioning', async (t) => {
5860
version: w2DeploymentVersion,
5961
defaultVersioningBehavior: 'PINNED',
6062
},
61-
connection: nativeConnection,
62-
skipClientWorkerSetCheck: true,
63+
connection: worker2Connection,
6364
});
6465
const worker2Promise = worker2.run();
6566
worker2Promise.catch((err) => {
6667
t.fail('Worker 2.0 run error: ' + err);
6768
});
6869

70+
const worker3Connection = await createNativeConnection();
71+
t.teardown(() => worker3Connection.close());
6972
const worker3 = await Worker.create({
7073
workflowsPath: require.resolve('./deployment-versioning-v3'),
7174
taskQueue,
@@ -74,8 +77,7 @@ test('Worker deployment based versioning', async (t) => {
7477
version: w3DeploymentVersion,
7578
defaultVersioningBehavior: 'PINNED',
7679
},
77-
connection: nativeConnection,
78-
skipClientWorkerSetCheck: true,
80+
connection: worker3Connection,
7981
});
8082
const worker3Promise = worker3.run();
8183
worker3Promise.catch((err) => {
@@ -144,6 +146,7 @@ test('Worker deployment based versioning with ramping', async (t) => {
144146
const taskQueue = 'worker-deployment-based-ramping-' + randomUUID();
145147
const deploymentName = 'deployment-ramping-' + randomUUID();
146148
const { client, nativeConnection } = t.context.env;
149+
const { createNativeConnection } = helpers(t);
147150

148151
const v1 = {
149152
buildId: '1.0',
@@ -163,13 +166,14 @@ test('Worker deployment based versioning with ramping', async (t) => {
163166
defaultVersioningBehavior: 'PINNED',
164167
},
165168
connection: nativeConnection,
166-
skipClientWorkerSetCheck: true,
167169
});
168170
const worker1Promise = worker1.run();
169171
worker1Promise.catch((err) => {
170172
t.fail('Worker 1.0 run error: ' + err);
171173
});
172174

175+
const worker2Connection = await createNativeConnection();
176+
t.teardown(() => worker2Connection.close());
173177
const worker2 = await Worker.create({
174178
workflowsPath: require.resolve('./deployment-versioning-v2'),
175179
taskQueue,
@@ -178,8 +182,7 @@ test('Worker deployment based versioning with ramping', async (t) => {
178182
version: v2,
179183
defaultVersioningBehavior: 'PINNED',
180184
},
181-
connection: nativeConnection,
182-
skipClientWorkerSetCheck: true,
185+
connection: worker2Connection,
183186
});
184187
const worker2Promise = worker2.run();
185188
worker2Promise.catch((err) => {

packages/testing/src/testing-workflow-environment.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export class TestWorkflowEnvironment {
9090
protected readonly server: native.EphemeralServer | 'existing',
9191
connection: Connection,
9292
nativeConnection: NativeConnection,
93-
namespace: string | undefined
93+
namespace: string | undefined,
94+
public readonly address: string
9495
) {
9596
this.connection = connection;
9697
this.nativeConnection = nativeConnection;
@@ -238,7 +239,16 @@ export class TestWorkflowEnvironment {
238239
[InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping },
239240
});
240241

241-
return new this(runtime, optsWithDefaults, supportsTimeSkipping, server, connection, nativeConnection, namespace);
242+
return new this(
243+
runtime,
244+
optsWithDefaults,
245+
supportsTimeSkipping,
246+
server,
247+
connection,
248+
nativeConnection,
249+
namespace,
250+
address
251+
);
242252
}
243253

244254
/**

packages/worker/src/worker-options.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,6 @@ export interface WorkerOptions {
464464
*/
465465
defaultHeartbeatThrottleInterval?: Duration;
466466

467-
/**
468-
* Skip the runtime validation that ensures the client is registered with the worker set.
469-
* This should only be used in tests.
470-
*
471-
* @default false
472-
*/
473-
skipClientWorkerSetCheck?: boolean;
474-
475467
/**
476468
* A mapping of interceptor type to a list of factories or module paths.
477469
*
@@ -825,7 +817,6 @@ export type WorkerOptionsWithDefaults = WorkerOptions &
825817
| 'debugMode'
826818
| 'reuseV8Context'
827819
| 'tuner'
828-
| 'skipClientWorkerSetCheck'
829820
>
830821
> & {
831822
interceptors: Required<WorkerInterceptors>;
@@ -977,7 +968,6 @@ function addDefaultWorkerOptions(
977968
stickyQueueScheduleToStartTimeout: '10s',
978969
maxHeartbeatThrottleInterval: '60s',
979970
defaultHeartbeatThrottleInterval: '30s',
980-
skipClientWorkerSetCheck: false,
981971
// 4294967295ms is the maximum allowed time
982972
isolateExecutionTimeout: debugMode ? '4294967295ms' : '5s',
983973
workflowThreadPoolSize: reuseV8Context ? 1 : 2,
@@ -1094,7 +1084,6 @@ export function toNativeWorkerOptions(opts: CompiledWorkerOptionsWithBuildId): n
10941084
maxTaskQueueActivitiesPerSecond: opts.maxTaskQueueActivitiesPerSecond ?? null,
10951085
maxActivitiesPerSecond: opts.maxActivitiesPerSecond ?? null,
10961086
shutdownGraceTime: msToNumber(opts.shutdownGraceTime),
1097-
skipClientWorkerSetCheck: opts.skipClientWorkerSetCheck,
10981087
};
10991088
}
11001089

0 commit comments

Comments
 (0)