-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
171 additions
and
10 deletions.
There are no files selected for viewing
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
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,32 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import assert from 'assert' | ||
import { minimumSsmActions, promptToAddInlinePolicy } from '../../shared/remoteSession' | ||
import { IamClient } from '../../shared/clients/iamClient' | ||
import { getTestWindow } from './vscode/window' | ||
import { cancel } from '../../shared' | ||
|
||
describe('minimumSsmActions', function () { | ||
it('should contain minimal actions needed for ssm connection', function () { | ||
assert.deepStrictEqual(minimumSsmActions, [ | ||
'ssmmessages:CreateControlChannel', | ||
'ssmmessages:CreateDataChannel', | ||
'ssmmessages:OpenControlChannel', | ||
'ssmmessages:OpenDataChannel', | ||
'ssm:DescribeAssociation', | ||
'ssm:ListAssociations', | ||
'ssm:UpdateInstanceInformation', | ||
]) | ||
}) | ||
|
||
it('prompts the user for confirmation before adding policies and allow cancels', async function () { | ||
getTestWindow().onDidShowMessage((message) => { | ||
assert.ok(message.message.includes('add'), 'should prompt to add policies') | ||
getTestWindow().getFirstMessage().selectItem(cancel) | ||
}) | ||
const added = await promptToAddInlinePolicy({} as IamClient, 'roleArnTest') | ||
assert.ok(!added, 'should not add policies by default') | ||
}) | ||
}) |
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,39 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import assert from 'assert' | ||
import { createExecutableFile, createTestWorkspaceFolder, copyEnv } from '../../testUtil' | ||
import path from 'path' | ||
import { fs } from '../../../shared' | ||
import { isWin } from '../../../shared/vscode/env' | ||
import { tryRun } from '../../../shared/utilities/pathFind' | ||
|
||
describe('copyEnv', function () { | ||
it('modifies the node environment variables (Non-Windows)', function () { | ||
// PATH returns undefined on Windows. | ||
if (isWin()) { | ||
this.skip() | ||
} | ||
|
||
const originalPath = copyEnv().PATH | ||
const fakePath = 'fakePath' | ||
process.env.PATH = fakePath | ||
assert.strictEqual(copyEnv().PATH, fakePath) | ||
|
||
process.env.PATH = originalPath | ||
assert.strictEqual(copyEnv().PATH, originalPath) | ||
}) | ||
}) | ||
|
||
describe('createExecutableFile', function () { | ||
it('creates a file that can be executed', async function () { | ||
const tempDir = await createTestWorkspaceFolder() | ||
const filePath = path.join(tempDir.uri.fsPath, `exec${isWin() ? '.cmd' : ''}`) | ||
await createExecutableFile(filePath, '') | ||
|
||
const result = await tryRun(filePath, [], 'yes') | ||
assert.ok(result) | ||
await fs.delete(tempDir.uri, { force: true, recursive: true }) | ||
}) | ||
}) |
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