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

test: fix flaky nsolid-metrics test #239

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/addons/nsolid-metrics/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ static void GetEnvMetricsGone(const FunctionCallbackInfo<Value>& args) {
assert(args[0]->IsNumber());
uint64_t thread_id = args[0].As<Uint32>()->Value();
SharedThreadMetrics tm = ThreadMetrics::Create(GetEnvInst(thread_id));
// The cb should never be called as SharedThreadMetrics is destroyed right
// after leaving the current scope.
// The cb should not be called most of the time as SharedThreadMetrics might
// be destroyed right after leaving the current scope.
args.GetReturnValue().Set(tm->Update(metrics_cb_gone, nullptr, tm.get()));
}

Expand Down
2 changes: 1 addition & 1 deletion test/addons/nsolid-metrics/nsolid-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (!isMainThread) {

process.on('beforeExit', mustCall(() => {
assert.strictEqual(binding.getCbCntr(), wkr_count);
assert.strictEqual(binding.getCbCntrGone(), 0);
assert.ok(binding.getCbCntrGone() < wkr_count/ 2);
assert.strictEqual(binding.getCbCntrLambda(), wkr_count);
}));

Expand Down
Loading