Add LSP Client and long running tests in tools#511
Conversation
| const output = data.toString().trim(); | ||
|
|
||
| // Readiness detection | ||
| if (output.includes('cfn-lint version')) { |
There was a problem hiding this comment.
Currently, the only way to determine if lint, guard, and the schemas are ready is through the logs. #507 Introduces a new LSP request which will return the guard, lint, and schema statuses. This addition will make testing more robust and speed up test time, but this PR is functional without this change
|
Our folder and file names are usually camelCased unless its a bin/cli command file |
tools/lsp-client/index.ts
Outdated
| @@ -0,0 +1,3 @@ | |||
| export { LspClient } from './LspClient'; | |||
There was a problem hiding this comment.
Removed index.ts file
tools/lsp-client/types.ts
Outdated
| @@ -0,0 +1,49 @@ | |||
| import { InitializeParams } from 'vscode-languageserver-protocol'; | |||
There was a problem hiding this comment.
Can all of this go in LspConnectionInterface? Should LspConnectionInterface be LspConnection ? our file names don't usually have interface naming
There was a problem hiding this comment.
Renamed LspConnectionInterface and file to LspConnection. Moved types.ts content into LspConnection.ts.
tools/lsp-client/types.ts
Outdated
| @@ -0,0 +1,49 @@ | |||
| import { InitializeParams } from 'vscode-languageserver-protocol'; | |||
|
|
|||
| export interface LspClientConfig { | |||
There was a problem hiding this comment.
Think a lot of these should be required not optional
There was a problem hiding this comment.
Made every property required except for:
- env
- storageDir
- suppressLogLevels
Also, added clientInfo and extensionInfo properties
tools/lsp-client/types.ts
Outdated
| suppressLogLevels?: string[]; | ||
| } | ||
|
|
||
| export interface ReadinessFlags { |
There was a problem hiding this comment.
Can't all the types from src be used?
There was a problem hiding this comment.
Modified to use all the src types
.gitignore
Outdated
| .DS_Store | ||
| tools/* | ||
| !tools/*.ts | ||
| !tools/lsp-client/ |
There was a problem hiding this comment.
The previous line can be updated to !tools/**/*.ts instead
There was a problem hiding this comment.
modified to use the lines: !tools//
!tools/**/.ts
!tools/*/ is necessary because without it the subdirectories will be ignored
| export type StandaloneTestMetrics = { | ||
| operationsAttempted: number; | ||
| operationsFailed: number; | ||
| averageDuration: number | null; |
There was a problem hiding this comment.
Can't these just be an array of numbers and the user decides what to do with them
There was a problem hiding this comment.
Because this test could run for a very long time and there are thousands of operations per minute, the duration array could get very large. We should keep the min, max, and average attributes to avoid having to calculate from the array. Added the durations array in case there's any other operations we use in the future, such as median or p99.
| } | ||
| } | ||
|
|
||
| export function generateFinalReport(testStartTime: number): void { |
There was a problem hiding this comment.
What will this report be used for?
There was a problem hiding this comment.
This prints out to the github actions logs upon completing successfully. I wanted to replicate a test coverage output report similar to what you see in vitest. We can't use vitest since it will not work with node 18
| } | ||
| } | ||
|
|
||
| void main(); |
There was a problem hiding this comment.
This will swallow the exception and succeed the run
There was a problem hiding this comment.
Added logic so that the exception is not swallowed in the event an exception (such as hover validation failure) occurs, and it fails fast. In the catch, we will explicitly throw the error
tools/long-running/Templates.ts
Outdated
|
|
||
| const cache = new Map<string, string>(); | ||
|
|
||
| const loadTemplate = (name: string): string => { |
There was a problem hiding this comment.
The template utils from src can be used directly
There was a problem hiding this comment.
Switched to using Templates const from the tst/utils
| console.log('Initialization complete'); | ||
| } | ||
|
|
||
| private async waitForSystemReadiness(): Promise<void> { |
There was a problem hiding this comment.
The system is "ready" but the orchestrator is "initializing/initialized"
There was a problem hiding this comment.
Modified verbiage, not using "ready", only initializing/initialized
|
Lots of references to "long-running" the caller of the main file defines the duration |
Fixed folder and file names so that folders are camelCased and files are PascalCased, which matches the styling in the rest of the package |
Changed to "Stability" tests instead of calling it LongRunning |
eed185f to
2ddb466
Compare
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.