Skip to content

Commit 4c389e8

Browse files
anthony-murphy-agentanthony-murphyclaude
committed
feat(local-server-stress-tests): increase ops before attach to 100
- Increase creationPhaseOps from 7 to 20 - Increase numOpsBeforeAttach from 20 to 100 - Increase total ops per test from 100 to 200 - Disable createDataStore/createChannel during DDS ops phase - Clear pendingLocalStateStore in test cleanup Co-Authored-By: anthony-murphy <[email protected]> Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent a400857 commit 4c389e8

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

packages/test/local-server-stress-tests/src/baseModel.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ export const reducer = combineReducersAsync<StressOperations, LocalServerStressS
7979

8080
/**
8181
* Number of operations in the "creation phase" before attach.
82-
* During this phase, we prioritize creating datastores and channels.
82+
* During this phase, only createDataStore and createChannel operations are generated.
8383
*/
84-
const creationPhaseOps = 7;
84+
const creationPhaseOps = 20;
8585

8686
export function makeGenerator<T extends BaseOperation>(
8787
additional: DynamicAsyncWeights<T, LocalServerStressState> = [],
@@ -116,8 +116,8 @@ export function makeGenerator<T extends BaseOperation>(
116116
asChild: state.random.bool(),
117117
tag: state.tag("datastore"),
118118
}),
119-
// High weight during creation phase, low weight otherwise
120-
(state) => (isCreationPhase(state) ? 20 : 1),
119+
// Only during creation phase (detached), normal weight when attached
120+
(state) => (isDdsOpsPhase(state) ? 0 : isCreationPhase(state) ? 20 : 1),
121121
],
122122
[
123123
async (state) => ({
@@ -134,8 +134,8 @@ export function makeGenerator<T extends BaseOperation>(
134134
channelType: state.random.pick([...ddsModelMap.keys()]),
135135
tag: state.tag("channel"),
136136
}),
137-
// High weight during creation phase, low weight otherwise
138-
(state) => (isCreationPhase(state) ? 20 : 5),
137+
// Only during creation phase (detached), normal weight when attached
138+
(state) => (isDdsOpsPhase(state) ? 0 : isCreationPhase(state) ? 20 : 5),
139139
],
140140
[
141141
async () => ({
@@ -158,10 +158,10 @@ export function makeGenerator<T extends BaseOperation>(
158158
],
159159
[
160160
DDSModelOpGenerator,
161-
// Low weight during creation phase, high weight during DDS ops phase
161+
// No DDS ops during creation phase, high weight during DDS ops phase
162162
(state) => {
163163
if (isCreationPhase(state)) {
164-
return 10;
164+
return 0;
165165
}
166166
if (isDdsOpsPhase(state)) {
167167
return 150;

packages/test/local-server-stress-tests/src/localServerStressHarness.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import { validateConsistencyOfAllDDS } from "./ddsOperations.js";
7777
import {
7878
createRuntimeFactory,
7979
StressDataObject,
80-
type DefaultStressDataObject,
80+
DefaultStressDataObject,
8181
} from "./stressDataObject.js";
8282
import { makeUnreachableCodePathProxy } from "./utils.js";
8383

@@ -379,7 +379,7 @@ export interface LocalServerStressOptions {
379379
const defaultLocalServerStressSuiteOptions: LocalServerStressOptions = {
380380
defaultTestCount: 100,
381381
detachedStartOptions: {
382-
numOpsBeforeAttach: 20,
382+
numOpsBeforeAttach: 100,
383383
},
384384
numberOfClients: 3,
385385
clientJoinOptions: {
@@ -1109,6 +1109,7 @@ async function runTestForSeed<TOperation extends BaseOperation>(
11091109

11101110
finalState.validationClient.container.dispose();
11111111
await finalState.localDeltaConnectionServer.close();
1112+
finalState.pendingLocalStateStore.clear();
11121113
}
11131114
}
11141115

packages/test/local-server-stress-tests/src/test/localServerStress.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
describe("Local Server Stress", () => {
2323
const model: LocalServerStressModel<StressOperations> = {
2424
workloadName: "default",
25-
generatorFactory: () => takeAsync(100, makeGenerator()),
25+
generatorFactory: () => takeAsync(200, makeGenerator()),
2626
reducer,
2727
validateConsistency: async (...clients) => {
2828
await validateAllDataStoresSaved(...clients);

0 commit comments

Comments
 (0)