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(perf): update thresholds in buildIndex tests #6228

Merged
merged 15 commits into from
Dec 12, 2024
7 changes: 3 additions & 4 deletions packages/core/src/testInteg/perf/buildIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import assert from 'assert'
import { LspClient, LspController } from '../../amazonq'
import { LanguageClient, ServerOptions } from 'vscode-languageclient'
import { createTestWorkspace } from '../../test/testUtil'
import { BuildIndexRequestType, GetRepomapIndexJSONRequestType, GetUsageRequestType } from '../../amazonq/lsp/types'
import { BuildIndexRequestType, GetUsageRequestType } from '../../amazonq/lsp/types'
import { fs, getRandomString } from '../../shared'
import { FileSystem } from '../../shared/fs/fs'
import { getFsCallsUpperBound } from './utilities'
Expand All @@ -22,11 +22,10 @@ interface SetupResult {
}

async function verifyResult(setup: SetupResult) {
// A correct run makes 3 requests, but don't want to make it exact to avoid over-sensitivity to implementation. If we make 10+ something is likely wrong.
assert.ok(setup.clientReqStub.callCount >= 3 && setup.clientReqStub.callCount <= 10)
// A correct run makes 2 requests, but don't want to make it exact to avoid over-sensitivity to implementation. If we make 10+ something is likely wrong.
assert.ok(setup.clientReqStub.callCount >= 2 && setup.clientReqStub.callCount <= 10)
assert.ok(setup.clientReqStub.calledWith(BuildIndexRequestType))
assert.ok(setup.clientReqStub.calledWith(GetUsageRequestType))
assert.ok(setup.clientReqStub.calledWith(GetRepomapIndexJSONRequestType))

assert.strictEqual(getFsCallsUpperBound(setup.fsSpy), 0, 'should not make any fs calls')
assert.ok(setup.findFilesSpy.callCount <= 2, 'findFiles should not be called more than twice')
Expand Down
Loading