Skip to content

Commit f4360e5

Browse files
committed
test: fix flaky test-grpc-continuous-profile
A couple of changes: - Extend time between enabling/disabling cont profiles. - Fix last test to make sure it start with cont profile disabled. PR-URL: #418 Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 9394bd4 commit f4360e5

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/agents/test-grpc-continuous-profile.mjs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,17 @@ tests.push({
179179
profileCount++;
180180
});
181181

182-
await setTimeout(250);
182+
await setTimeout(500);
183183
assert.ok(profileCount >= 1);
184184

185185
await child.config({ assetsEnabled: false });
186186
const countAfterDisable = profileCount;
187187

188-
await setTimeout(250);
188+
await setTimeout(500);
189189
assert.ok(profileCount - countAfterDisable <= 1);
190190

191191
await child.config({ assetsEnabled: true });
192-
await setTimeout(250);
192+
await setTimeout(500);
193193
assert.ok(profileCount > countAfterDisable);
194194

195195
await child.shutdown(0);
@@ -220,17 +220,19 @@ tests.push({
220220
profileCount++;
221221
});
222222

223-
await setTimeout(250);
223+
await setTimeout(500);
224224
assert.ok(profileCount >= 1);
225225

226226
await child.disableAssets();
227227
const countAfterDisable = profileCount;
228228

229-
await setTimeout(250);
229+
await setTimeout(500);
230+
console.log('profileCount after disableAssets:', profileCount, 'countAfterDisable:', countAfterDisable);
230231
assert.ok(profileCount - countAfterDisable <= 1);
231232

232233
await child.enableAssets();
233-
await setTimeout(250);
234+
await setTimeout(500);
235+
console.log('profileCount after enableAssets:', profileCount, 'countAfterDisable:', countAfterDisable);
234236
assert.ok(profileCount > countAfterDisable);
235237

236238
const currentConfig = await child.config();
@@ -345,6 +347,8 @@ tests.push({
345347

346348
// Start TestClient without continuous profiling
347349
const env = getEnv(port);
350+
delete env.NSOLID_CONT_CPU_PROFILE;
351+
delete env.NSOLID_CONT_CPU_PROFILE;
348352

349353
const opts = {
350354
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
@@ -361,7 +365,9 @@ tests.push({
361365
threadId: 0,
362366
};
363367

364-
await grpcServer.cpuProfile(agentId, options);
368+
const { data, requestId } = await grpcServer.cpuProfile(agentId, options);
369+
assert.ok(data);
370+
assert.ok(requestId);
365371

366372
grpcServer.on('profile', async (data) => {
367373
// This is a continuous profile

0 commit comments

Comments
 (0)