-
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
Merged
Merged
Changes from 202 commits
Commits
Show all changes
205 commits
Select commit
Hold shift + click to select a range
b7399c5
rename existing command to openTerminal
Hweinstock 588594d
add new command for ec2 instance remote-connect
Hweinstock 1c57e45
register new command so that it does not throw error
Hweinstock 814ba96
refactor to make terminal distinction clearer
Hweinstock b5d2c88
add prompt for new selection
Hweinstock 08ba106
enable connection to ec2, start generalizing CodeCatalyst work
Hweinstock 3caba57
abstract general error msg to its own function
Hweinstock f2894ba
refactor more code catalyst code
Hweinstock f0f5086
refactor code to better mirror the code catalyst implementaton
Hweinstock 5be1f8d
add a cancellable loading bar on open
Hweinstock 3c096cd
rename variable to be more explicit
Hweinstock 13b2bc0
refactor to have a with-progress method layer
Hweinstock 8fbbc8d
refactor ssh config into the ssh file
Hweinstock 57dbde6
convert regExp property to abstract
Hweinstock fb9f1e8
reformat string in proxycommand
Hweinstock f94fe64
implement basic tests on sshconfig mock object
Hweinstock fdec798
split up verify ssh host into pieces
Hweinstock 545b8a7
refactor the sshconfig to make more testable, add more tests
Hweinstock 4f8c680
refactor tests to distinguish between command and proxyCommand
Hweinstock 222fcfd
avoid hard-coding in test
Hweinstock 0e5f7a2
avoid other hard-coding in tests
Hweinstock e87f24d
change simple function to be in lined
Hweinstock 3764b4a
change command wording to be less clunky.
Hweinstock 1c3be08
change command phrasing to mirror ssh extension
Hweinstock 93e23f0
Merge branch 'hkobew/ec2/remoteConnect/newCommand' into hkobew/ec2/re…
Hweinstock d742eef
Merge branch 'hkobew/ec2/remoteConnect/connect' into hkobew/ec2/remot…
Hweinstock 056e807
remove commented out code
Hweinstock 153bf62
update command file with icon
Hweinstock bd71166
update context value for parent node
Hweinstock e027e40
handle case where parent node is passed to command
Hweinstock 9d62154
change outdated prompter text
Hweinstock f28809b
refactor commands to own file
Hweinstock 3cc9aa6
add start command to package.json files
Hweinstock 732778f
add command to start the instance
Hweinstock 2cbb723
fix typo in which method was being invoked
Hweinstock 26faa78
merge upstream changes
Hweinstock ea30d86
refactor prompter and commands file
Hweinstock 52a2fde
add tests for new structure of prompter
Hweinstock 8fac525
refactor prompter code to be more testable
Hweinstock 004ac0b
add baseline test to item provider
Hweinstock f85f0ee
add instance filter and tests for it
Hweinstock 29d6b62
remove duplication of determining if instance is running
Hweinstock 506be9a
backtrack filter idea because it breaks pagination
Hweinstock 2022004
implement start command
Hweinstock 8560da2
move bulk of work to new file
Hweinstock 9022ec2
add command for stopping instance
Hweinstock fd1703d
add functionality to stop instances
Hweinstock 9e0c16e
refactor start/stop commands into a class
Hweinstock 1f53a3f
add testing for checking instance status
Hweinstock eb92609
add reboot command
Hweinstock cec3ede
implement reboot extension
Hweinstock 024eb7b
refactor to remove duplicate code
Hweinstock 38559be
remove unnecessary async
Hweinstock b217377
expose command on explorer
Hweinstock 19ad794
refactor to eliminate some duplicate implementation
Hweinstock 7794b67
handle undefined node consistently
Hweinstock adae37b
add method to append status to instance retriever
Hweinstock d3a4276
refactor how we add fields to the ec2 instances
Hweinstock 0772dd2
add tests for new helper functions in Ec2Client
Hweinstock b4c03c3
refactor tests to use the same test-data
Hweinstock b76e22f
add test for filter functionality
Hweinstock 98f03fb
change prompter to filter based on instance status
Hweinstock 6cc4cc5
add icons to QuickPick
Hweinstock d147b22
disallow rebooting stopped instance
Hweinstock d72f9c9
add icon entrypoints to start/stop/restart commands
Hweinstock bd709da
move icon determiner function to seperate file
Hweinstock bffa367
add icons to show if its running in explorer
Hweinstock 8062ed6
limit commands to cases where they are dont throw error
Hweinstock f7999b1
limit explorer icons and refresh after
Hweinstock f2a7786
fix outdated test
Hweinstock cf05c8e
remove commands from command palette
Hweinstock f0900d7
refactor such that it only updates ec2 parent node
Hweinstock 10566c1
update outdated test
Hweinstock 2b749a3
add testing to ec2InstanceNode
Hweinstock bf25145
add another test for the update functionality
Hweinstock de97b43
update tests to use icons
Hweinstock 1914fe8
implement core logic with basic tests
Hweinstock ce7beb9
refactor to key by node, rather than string
Hweinstock a5cf7f3
switch back to using instanceids to add more testing
Hweinstock 177aa07
ensure timer stops with tests
Hweinstock dd82ff9
refactor tests to avoid polling before tests start
Hweinstock 76eb0fd
refactor such that only instance node is refreshed
Hweinstock 5ad533f
no stopping/starting on pending instances
Hweinstock 6efd4fd
refactor sshConfig changes to their own new file
Hweinstock 4a68497
move the creation of ssh section to parent abstract class
Hweinstock ba21411
move ensureConnect to shared file
Hweinstock 5ec5496
move ensure valid method to shared file
Hweinstock 6c03515
remove sub-classes
Hweinstock 7e6c56e
switch scriptPrefix to a parameter
Hweinstock 19d3e2c
use variable to name prefix of script
Hweinstock 886a41e
add test for section created by sshConfig
Hweinstock a4a4626
construct regexp from script name
Hweinstock 8b36799
move logFile location generator to general file
Hweinstock 72ae902
refactor the ec2_connect script
Hweinstock b08bbdb
refactor script to include token for session
Hweinstock c4348b4
include session tokens in script env
Hweinstock 02b2a2b
adding suport for documents in start session
Hweinstock e373be8
remove port number
Hweinstock 0f2c01d
remove log file location where unused
Hweinstock 718c402
clean up state after tests
Hweinstock a21d6f8
hide start/stop/reboot from command palette
Hweinstock 60566f5
add functionality to generate keys
Hweinstock e15c0a2
implement sending keys to target instance, with hard coded dest file
Hweinstock 41eade4
implement reading public key from KeyPair
Hweinstock 33fbd79
add comment about hard coded path
Hweinstock 8cb386d
fix some spacing
Hweinstock 84fa815
update config to get it working
Hweinstock dca607e
cleanup some small things
Hweinstock f6ac8e3
add some testing
Hweinstock e15e184
clean up handling of key parameters to ssh config
Hweinstock 6950712
updates tests to utilize sinon stub
Hweinstock d951675
remove references to code catatlyst in error/log messages
Hweinstock 2a63ae3
pass remote username down from above
Hweinstock 1087678
increase testing coverage for sshConfigSection
Hweinstock 84ea20a
implement method to determine remote user
Hweinstock eed3a09
implement method for guessing the os
Hweinstock 4b94c83
refactor to use ssm sdk to determine os
Hweinstock 65ad6ac
check for permissions before trying the ssm sdk
Hweinstock febac95
fix to work on ubuntu
Hweinstock ee149b7
remove leftover log statement
Hweinstock d70c415
merge in master
Hweinstock aa56c93
refactor tests to use stub only where needed
Hweinstock 90b248b
remove double restore in test file
Hweinstock 950ca3c
test commenting out sshConfig tests
Hweinstock f17580d
add comment to import so that it runs
Hweinstock ac4e711
comment out other use of sinon stub for testing
Hweinstock 7441de1
comment out test for reading ssh keys
Hweinstock ef427f2
comment out tests in the model file
Hweinstock a0cea9d
comment out entire codecatalyst tools file
Hweinstock 740baf8
comment out all tests modified
Hweinstock c60d540
uncomment test files
Hweinstock 2a08bb7
move ssh tests to their own file
Hweinstock 24a25d0
uncomment tests related to the model
Hweinstock 27179ab
move the rest of the the tests to the sshConfig file
Hweinstock a8a92ae
add codecatalyst label to relevant tests
Hweinstock d6896c1
rename file to mirror main class name in file
Hweinstock e201693
rename test file
Hweinstock 3bbabd1
change path import structure
Hweinstock 59e9f9c
merge in master
Hweinstock 58f6ff6
merge in master
Hweinstock f4cccca
merge master
Hweinstock 8e281cd
fix duplicate declaration error
Hweinstock 54ed468
separate return statement from body of return.
Hweinstock c8f5cd3
attach sdout to error
Hweinstock aab45f7
merge in master
Hweinstock ba6afbf
fix failing tests
Hweinstock b10b74c
Merge branch 'hkobew/ec2/remoteConnect/sshKeysNew' of https://github.…
Hweinstock 57ad523
handle merge conflicts
Hweinstock dd05a0d
remove duplicate commands
Hweinstock 08a1087
Merge branch 'master' into hkobew/ec2/remoteConnect/explorer
Hweinstock ce8db34
add icon back for terminal on explorer
Hweinstock eb4ed03
Merge branch 'hkobew/ec2/remoteConnect/sshKeysNew' into hkobew/ec2/re…
Hweinstock 7c0e57d
expose command on explorer
Hweinstock 40abd17
merge in upstream changes
Hweinstock ae3851c
merge in master
Hweinstock 9cbcb48
remove duplicate commands in package.json
Hweinstock 4d6cd41
remove duplicate terminal command
Hweinstock d4a2244
merge in master
Hweinstock ac6d473
make instance readonly on instance node
Hweinstock e40064a
merge in master
Hweinstock 292bc56
fix merge errors in duplicate commands
Hweinstock 3eeba07
enable utility functions on pending nodes
Hweinstock 3e73b23
remove dead files
Hweinstock 6cab577
add comment about not-readonly
Hweinstock a034dc3
refactor to allow for readonly instance with comment
Hweinstock 60e1d41
add telemetry for remote connection through vscode
Hweinstock f58867d
add new type on ec2connect metric to track interface
Hweinstock 2854015
merge in master
Hweinstock f21201f
merge in master, update imports
c9d6eff
update vscode.command usage
Hweinstock 49efa8b
add changelog
Hweinstock 0cc83e3
start to generalize polling set
Hweinstock 996362c
minimize code dupe
Hweinstock 1e6cdcf
cleanup
Hweinstock 4e97666
generalize further, extend tests
Hweinstock 9d9fa8d
fix linting problems
Hweinstock 79b8f81
fix linting 2
Hweinstock 681771e
Merge branch 'master' into hkobew/ec2/explorerUpdate
Hweinstock 955308c
clean up inlining
Hweinstock 6c30851
merge upstream changes
Hweinstock b77dc8d
move test files over
Hweinstock 548f69e
move rest of changes from other branch
Hweinstock f152943
fix imports
Hweinstock 1af46cd
update changelog
Hweinstock f6b805e
merge in upstream changes
Hweinstock f1c6fee
move over changes
Hweinstock 727d7a5
Merge branch 'hkobew/ec2/remoteConnect/telemetry' into hkobew/ec2/rem…
Hweinstock 5aabfde
merge in upstream changes
Hweinstock 0382de6
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock 7311f0d
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock 58c611a
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock 64c9e5a
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock 3dae58c
remove temp check
Hweinstock ea2a1ce
add tests for telemetry
Hweinstock 026d39d
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock ceba452
bump telemetry version
Hweinstock 59cdd21
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock 4823d91
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock f5f82c9
disable polling set
Hweinstock 0cc31e3
restore stubs afterwards
Hweinstock 16492c2
merge in upstream
Hweinstock 26b25bf
rename tests to be general activation tests
Hweinstock 1bfde6b
merge master
Hweinstock 6b9eb69
move telemetry into a single test
Hweinstock 1e086f0
Merge branch 'master' into hkobew/ec2/remoteConnect/telemetry
Hweinstock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import * as vscode from 'vscode' | ||
import * as sinon from 'sinon' | ||
import { assertTelemetry } from '../../testUtil' | ||
import { Ec2InstanceNode } from '../../../awsService/ec2/explorer/ec2InstanceNode' | ||
import { Ec2ParentNode } from '../../../awsService/ec2/explorer/ec2ParentNode' | ||
import { Ec2Client } from '../../../shared/clients/ec2Client' | ||
import { Ec2Connecter } from '../../../awsService/ec2/model' | ||
import { PollingSet } from '../../../shared/utilities/pollingSet' | ||
|
||
describe('ec2 activation', function () { | ||
let testNode: Ec2InstanceNode | ||
|
||
before(function () { | ||
const testRegion = 'test-region' | ||
const testPartition = 'test-partition' | ||
// Don't want to be polling here, that is tested in ../ec2ParentNode.test.ts | ||
// disabled here for convenience (avoiding race conditions with timeout) | ||
sinon.stub(PollingSet.prototype, 'start') | ||
const testClient = new Ec2Client(testRegion) | ||
const parentNode = new Ec2ParentNode(testRegion, testPartition, new Ec2Client(testRegion)) | ||
testNode = new Ec2InstanceNode(parentNode, testClient, testRegion, testPartition, { | ||
InstanceId: 'testId', | ||
LastSeenStatus: 'status', | ||
}) | ||
}) | ||
|
||
after(function () { | ||
sinon.restore() | ||
}) | ||
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() | ||
}) | ||
|
||
it('state stop', async function () { | ||
const stopInstanceStub = sinon.stub(Ec2Client.prototype, 'stopInstanceWithCancel') | ||
await vscode.commands.executeCommand('aws.ec2.stopInstance', testNode) | ||
|
||
assertTelemetry('ec2_changeState', { ec2InstanceState: 'stop' }) | ||
stopInstanceStub.restore() | ||
}) | ||
|
||
it('state start', async function () { | ||
const startInstanceStub = sinon.stub(Ec2Client.prototype, 'startInstance') | ||
await vscode.commands.executeCommand('aws.ec2.startInstance', testNode) | ||
|
||
assertTelemetry('ec2_changeState', { ec2InstanceState: 'start' }) | ||
startInstanceStub.restore() | ||
}) | ||
|
||
it('state reboot', async function () { | ||
const rebootInstanceStub = sinon.stub(Ec2Client.prototype, 'rebootInstance') | ||
await vscode.commands.executeCommand('aws.ec2.rebootInstance', testNode) | ||
|
||
assertTelemetry('ec2_changeState', { ec2InstanceState: 'reboot' }) | ||
rebootInstanceStub.restore() | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: thedescribe()
is still "general", but just a singleit()
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.