Skip to content

Commit

Permalink
test(perf): update thresholds in buildIndex tests (#6228)
Browse files Browse the repository at this point in the history
## Problem
Performance test was reliant on dead code removed in
#6218

## Solution
- update thresholds to accommodate the change. 

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
  • Loading branch information
Hweinstock authored Dec 12, 2024
1 parent d682314 commit 5b5df85
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 5b5df85

Please sign in to comment.