-
Notifications
You must be signed in to change notification settings - Fork 482
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
telemetry(ec2): add more detailed metric on remote VSCode connection. #3723
Conversation
Co-authored-by: JadenSimon <31319484+JadenSimon@users.noreply.github.com>
…moteConnect/connect
…eConnect/sshConfig
This pull request modifies code in src/ but no tests were added/updated. Confirm whether tests should be added or ensure the PR description explains why tests are not required. |
Do I need to wait until next release of https://github.com/aws/aws-toolkit-common for this to not fail? |
aws/aws-toolkit-common@533415f was released in aws/aws-toolkit-common@49de773 (1.0.273). So updating the dependency here to 1.0.273 or later should work. |
linux ci found unhandled promise rejections
|
Ahhhh, forgot to disable the timer in the new tests. I feel like how I implemented the PollingSet as part of the class is becoming a code smell, with how it makes tests flaky if you aren't careful. Do you see a way to simplify it, and avoid the need the disable the polling whenever testing? |
it('terminal open', async function () { | ||
const terminalStub = sinon.stub(Ec2Connecter.prototype, 'attemptToOpenEc2Terminal') | ||
await vscode.commands.executeCommand('aws.ec2.openTerminal', testNode) | ||
|
||
assertTelemetry('ec2_connectToInstance', { ec2ConnectionType: 'ssm' }) | ||
terminalStub.restore() | ||
}) | ||
|
||
it('remote window open', async function () { | ||
const remoteWindowStub = sinon.stub(Ec2Connecter.prototype, 'tryOpenRemoteConnection') | ||
await vscode.commands.executeCommand('aws.ec2.openRemoteConnection', testNode) | ||
|
||
assertTelemetry('ec2_connectToInstance', { ec2ConnectionType: 'remoteWorkspace' }) | ||
remoteWindowStub.restore() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if these tests have stubbed the command so that it does nothing useful, then they could all be one it('telemetry')
test (note: the describe()
is still "general", but just a single it()
test is for testing telemetry specifically).
Alternatively, if there are existing tests for these commands, can't those existing tests call assertTelemetry
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The high-level commands are simply wrappers around the logic that is tested in https://github.com/aws/aws-toolkit-vscode/blob/142761e268dd48687d0f696f6ded22819c74ffc7/packages/core/src/test/awsService/ec2/model.test.ts. The only difference at this level is the prompting logic (tested in https://github.com/aws/aws-toolkit-vscode/blob/142761e268dd48687d0f696f6ded22819c74ffc7/packages/core/src/test/awsService/ec2/prompter.test.ts) and telemetry (tested here). It doesn't seem to me to make sense to test any E2E aspects of the code beyond telemetry here.
Problem
Solution
remoteWorkspace
for opening VSCode window within instance.remoteWorkspace
connect type for ec2. aws-toolkit-common#885License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.