Skip to content
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

Add simple integration test, with an LSP client PowerShell module #944

Merged
merged 47 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c708a1b
Add first parts of ps pses client
Apr 19, 2019
e36001a
Make message reading work
Apr 19, 2019
9e67dea
Start pipe module
rjmholt Apr 22, 2019
b66a9ac
Add simple startup test
rjmholt Apr 22, 2019
6711016
Add shutdown test
rjmholt Apr 22, 2019
be4587e
Add pester installation to build step
rjmholt Apr 22, 2019
2158e3b
Response to Codacy bot's feedback
rjmholt Apr 22, 2019
4952bad
Add classes and types to psm1
rjmholt Apr 22, 2019
7ba21c2
Fix build logic, add return types
rjmholt Apr 23, 2019
558abc0
Rename pester test file to be more specific
rjmholt Apr 23, 2019
5c35561
Kill process properly
rjmholt Apr 23, 2019
81631a1
Fix process kill
rjmholt Apr 23, 2019
adcb527
Add diagnostic line;
rjmholt Apr 23, 2019
b16429d
Attempt to exit
rjmholt Apr 23, 2019
0435cb6
Add some documentation comments
rjmholt Apr 24, 2019
7e9a76d
Ensure pipe is closed during disposal
rjmholt Apr 24, 2019
9b66b61
Fix pipe disposal
rjmholt Apr 24, 2019
d949558
Change cancellation method
rjmholt Apr 24, 2019
b061b65
Try invoking pester in proc
rjmholt Apr 25, 2019
6b13e22
Add doc comments
rjmholt Apr 25, 2019
29ccd29
Use better exceptions
rjmholt Apr 25, 2019
2896933
Comply with some of Codacy's draconian views
rjmholt Apr 25, 2019
7b3ee70
Publish Pester results in CI
rjmholt Apr 26, 2019
5a2b3d0
Remove .vscode folder
rjmholt Apr 26, 2019
3bb6df4
Merge branch 'master' into integration-tools
rjmholt Apr 26, 2019
228b5eb
Fix typo
rjmholt Apr 26, 2019
516cbb0
Fix NRE in test
rjmholt Apr 26, 2019
beeef02
Improve client module building
rjmholt Apr 26, 2019
dae7511
Pass through dotnet location
rjmholt Apr 26, 2019
f8654d6
Ensure new enough Pester is installed
rjmholt Apr 26, 2019
14b8884
Add -Force flag
rjmholt Apr 26, 2019
4069a40
Update tools/PsesPsClient/PsesPsClient.psd1
TylerLeonhardt Apr 30, 2019
a6e2e99
Rework module, address @TylerLeonhardt's feedback
rjmholt Apr 30, 2019
e8529dd
Update PowerShellEditorServices.build.ps1
TylerLeonhardt May 3, 2019
b0d704c
Update tools/PsesPsClient/Client.cs
rjmholt May 9, 2019
1b90683
Add server output to integration test
May 14, 2019
c0bcefb
Try stderr recording
May 14, 2019
d9b3a0b
Try procinfo
May 14, 2019
c48b586
Don't use stream when it doesn't exist
May 14, 2019
e2e3c9b
Try again with error file
May 14, 2019
a7e599c
Use log parser to find errors
May 14, 2019
47cdb90
Add test exception for pwsh pipe close error
May 14, 2019
d5a67c2
Improve error message
May 14, 2019
dc2506e
Test without skipping crash log exception
May 15, 2019
135d47d
Try ending server stream first
May 15, 2019
37ddedf
Improve testing
May 15, 2019
9f5666f
Add comments about test ordering
May 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve client module building
  • Loading branch information
rjmholt committed Apr 26, 2019
commit beeef028ff161add0b20cc2d9ef4a3fe19a8c5d9
3 changes: 2 additions & 1 deletion test/Pester/EditorServices.Integration.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Describe "Loading and running PowerShellEditorServices" {
BeforeAll {
Import-Module "$PSScriptRoot/../../tools/PsesPsClient"
Import-Module "$PSScriptRoot/../../module/PowerShellEditorServices"
Import-Module "$PSScriptRoot/../../tools/PsesPsClient/out/PsesPsClient"

$psesServer = Start-PsesServer
$pipe = Connect-NamedPipe -PipeName $psesServer.SessionDetails.languageServicePipeName
Expand Down
7 changes: 6 additions & 1 deletion tools/PsesPsClient/LspPipe.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

using System;
using System.IO.Pipes;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
Expand Down
2 changes: 1 addition & 1 deletion tools/PsesPsClient/PsesPsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="System.IO.Pipes" Version="4.3.0" />
</ItemGroup>

Expand Down
124 changes: 124 additions & 0 deletions tools/PsesPsClient/PsesPsClient.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#
# Module manifest for module 'PsesPsClient'
#
# Generated by: Microsoft Corporation
#
# Generated on: 26/4/19
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'PsesPsClient.psm1'

# Version number of this module.
ModuleVersion = '0.0.1'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'

# ID used to uniquely identify this module
GUID = 'ce491ff9-3eab-443c-b3a2-cc412ddeef65'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Unknown'
rjmholt marked this conversation as resolved.
Show resolved Hide resolved

# Copyright statement for this module
Copyright = '(c) Microsoft Corporation'

# Description of the functionality provided by this module
# Description = ''

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.1'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @('PsesPsClient.dll')

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Start-PsesServer', 'Connect-NamedPipe', 'Send-LspInitializeRequest',
'Send-LspShutdownRequest'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()

# A URL to the license for this module.
# LicenseUri = ''

# A URL to the main website for this project.
# ProjectUri = ''

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

11 changes: 6 additions & 5 deletions tools/PsesPsClient/PsesPsClient.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
$script:PsesBundledModulesDir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"$PSScriptRoot/../../module")

Import-Module "$script:PsesBundledModulesDir/PowerShellEditorServices"
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

Import-Module $PSScriptRoot/bin/Debug/netstandard2.0/PsesPsClient.dll
$script:PsesBundledModulesDir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"$PSScriptRoot/../../../../module")

class PsesStartupOptions
{
Expand Down
28 changes: 26 additions & 2 deletions tools/PsesPsClient/build.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

param(
[switch]
$Clean
)

$ErrorActionPreference = 'Stop'

$script:OutDir = "$PSScriptRoot/out"
$script:OutModDir = "$script:OutDir/PsesPsClient"

$script:ModuleComponents = @{
"bin/Debug/netstandard2.0/publish/PsesPsClient.dll" = "PsesPsClient.dll"
"bin/Debug/netstandard2.0/publish/Newtonsoft.Json.dll" = "Newtonsoft.Json.dll"
"PsesPsClient.psm1" = "PsesPsClient.psm1"
"PsesPsClient.psd1" = "PsesPsClient.psd1"
}

if ($Clean)
{
$binDir = "$PSScriptRoot/bin"
$objDir = "$PSScriptRoot/obj"
foreach ($dir in $binDir,$objDir)
foreach ($dir in $binDir,$objDir,$script:OutDir)
{
if (Test-Path $dir)
{
Expand All @@ -19,7 +36,14 @@ if ($Clean)
Push-Location $PSScriptRoot
try
{
dotnet build
dotnet publish

New-Item -Path $script:OutModDir -ItemType Directory
foreach ($key in $script:ModuleComponents.get_Keys())
{
$val = $script:ModuleComponents[$key]
Copy-Item -Path "$PSScriptRoot/$key" -Destination "$script:OutModDir/$val"
}
}
finally
{
Expand Down