Commit graph

6261 commits

Author SHA1 Message Date
Mark Kraus 525f5933b1 Fix Web Cmdlets for .NET Core 2.1 (#6806)
closes #6728
Breaking change approved in #6728
This PR switches the logic of when the Web Cmdlets handle redirects when the Authorization header is present. .NET Core 2.1 no longer sends the Authorization header by default (dotnet/corefx#26864). however, we introduced the ability to do so leveraging the previous default behavior through the use of the -PreserveAuthorizationOnRedirect switch.

This PR also corrects a bug introduced 6.0.0 where certain redirect types redirect from POST to GET were set which should have passed through POST to POST and some were improperly passing through POST to POST which should have been doing POST to GET. This correction is a breaking change. It was made apparent as now the redirection behavior is being managed by CoreFX which is doing the correct behavior, tests were added for both when CoreFX and the Web Cmdlets manage redirection.
2018-05-14 11:37:30 -07:00
Aditya Patwardhan d07a3e7c2f
Add functions to merge Pester and Xunit logs (#6854) 2018-05-10 17:46:45 -07:00
Dongbo Wang db45785341
Fix a module-loading regression that caused an infinite loop (#6843)
This regression was introduced by #6523, in `PSModuleInfo.cs`. A circular nested module check was removed because the comment there suggested it happens only with a deprecated workflow module. This causes a `StackOverflow` exception when running into circular nested modules.

Circular nested modules could happen for a module that is not well structured. For example, the module folder `test` contains two files: `test.psd1` and `test.psm1`, and `test.psd1` has the following content:
   @{ ModuleVersion = '0.0.1'; RootModule = 'test'; NestedModules = @('test') }

The same value `test` is put in both RootModule and NestedModule, which will end up with a module whose nested module points to itself.

There are two changes in this PR:
1. Add back the check for circular nested modules in `PSModuleInfo.cs`.
2. Remove a wrong `Dbg.Assert` in `ModuleCmdletBase.cs` and two checks before it.
   - For the assertion `Dbg.Assert(newManifestInfo.SessionState == ss`, when facing the example above, the nested module will first be loaded with a different session state, and then when trying to load the root module, the same loaded nested module will be reused for it. So 'newManifestInfo.SessionState' is not `ss`. The assertion will fail in that case.
   - For the two checks before the assertion, they are not needed anymore based on the comments there.
2018-05-10 16:09:36 -07:00
Travis Plunk 4af9f4edac
fix create docker manifest script to work with more complex tags and with repeated use (#6852)
fix create docker manifest script to work with more complex tags and with repeated use
- add characters to validation pattern
- purge manifest after pushing as there is no other way to delete the manifest.
2018-05-10 14:36:47 -07:00
Mark Kraus 0f036d9939 Enable Web Cmdlets Tests for Greater Platform Support (#6836) 2018-05-09 16:35:52 +05:00
Steve Lee 793160228a Fix crash when terminal is reset (#6777)
* fix crash when terminal is reset

* fix check before removing characters
2018-05-08 12:53:13 -07:00
Dongbo Wang 1de9fb5589
Fix build.psm1 to not add tool path to $PATH twice (#6834) 2018-05-08 09:20:39 -07:00
Mark Kraus f54a0ab033 Quote Multipart/Form-Data Field Names (#6782) 2018-05-08 09:18:09 +05:00
Ilya 4737ebae20
Remove web cmdlet tests using proxy env variables (#6808) 2018-05-08 09:15:49 +05:00
Sergey Vasin d1b9aa7eae Remove empty branch and add Dbg.Assert in ExportCsvHelper. (#6816)
Remove Dbg.Assert and add ArgumentNullException.
2018-05-08 08:44:50 +05:00
Travis Plunk f33689b4cb
Update docker files to allow specifying pwsh and from image version (#6835)
Update docker files to allow specifying pwsh and from image version
- Also updated to install security updates when building images
2018-05-07 18:01:12 -07:00
Travis Plunk 8f37c920ef
Blacklist System.Windows.Forms form loaded to prevent a crash (#6822)
Blacklist `System.Windows.Forms` (`WinForms`) from being loaded to prevent a crash
2018-05-07 16:38:27 -07:00
Andrew e0ee13c699 Updates to fedora27 and kalilinux dockerfiles (#6819)
This PR addresses 2 issues:

fedora27 dockerfiles were missing compat-openssl10 prerequisite that on Linux-based Docker hosts produced error No usable version of the libssl was found during Restore-PSPester.
kalilinux PS package validation is failing because of open issue #5413 , so disabling this config for now.
2018-05-07 13:02:01 -07:00
Robert Holt d96a321b49 Change packaging to support Ubuntu 17.10 and 18.04 (#6769)
Ubuntu 17.04 is EOL, so we need to update our packaging for Ubuntu 17.10. This updates the package script and build.psm1 to use 17.10 rather than 17.04.
2018-05-07 12:30:58 -07:00
Sergey Vasin 0b414f67a0 Change -Quiet parameter of Invoke-Pester to -Show None. (#6798) 2018-05-04 09:54:00 -07:00
Robert Holt 5cc27e2059 Add code coverage report generation instructions (#6515)
* Add code coverage report generation instructions

* Add Publish-PSTestTools in docs

* Add references to coverage comparison commands
2018-05-04 09:51:08 -07:00
Sergey Vasin 1be0594f45 Improve code coverage in Export-Csv.Tests.ps1. (#6795)
* Improve code coverage in Export-Csv.Tests.ps1.

* Change test logic.
2018-05-04 09:46:26 -07:00
Ilya c1026b3ae8 Remove 'more' function and move the $env:PAGER capability into the help function (#6059) 2018-05-04 09:25:05 -07:00
Patochun 145cb77226 Update Tests Isfile to correct response for "/" (#6754)
I Think the good answer for "/" is a directory, not a file.
So I recommand to change EXPECT_TRUE by EXPECT_FALSE for this case.
2018-05-03 14:28:44 -07:00
PRASOON KARUNAN V ec678be4f4 Implementation of -lp alias for -LiteralPath variable #6732 (#6770)
Implementation of -lp alias for -LiteralPath variable for issue #6732 

Add-Content 

Add-Type 

Clear-Content 

Clear-Item 

Clear-ItemProperty 

Convert-Path 

Copy-Item 

Export-Alias 

Export-Clixml 

Export-Csv 

Export-FormatData 

Format-Hex 

Get-ChildItem 

Get-Content 

Get-FileHash 

Get-Item 

Get-ItemProperty 

Get-ItemPropertyValue 

Import-Alias 

Import-Clixml 

Import-Csv 

Import-PowerShellDataFile 

Move-Item 

Out-File 

Push-Location 

Remove-Item 

Rename-Item 

Resolve-Path 

Select-String 

Select-Xml 

Set-Content 

Set-Item 

Set-ItemProperty 

Set-Location 

Split-Path 

Start-Job 

Start-Transcript 

Tee-Object 

Test-Path 

Unblock-File
2018-05-03 14:22:48 -07:00
Ilya 84344cbb32 Update PowerShell to build with .NET Core SDK 2.1.300-rc1-008662 (#6718)
* Build Update
- Change `TargetFramework` to `netcoreapp2.1` and removed unnecessary `RuntimeFrameworkVersion` from `PowerShell.Common.props`
- Update dotnet SDK to 2.1.300-rc1-008662
- Update `TypeGen` target in `Build.psm1` to work with 2.1
- Rename macOS runtime to `osx-x64` as the old build logic expects 10.12 and breaks running on 10.13 system.
- Remove `PackageReference` to `System.Memory` as it's part of dotnetcore 2.1
- Update search for `crossgen` executable to find the matching version

* Test Update
- Update test tools `WebListener` to latest `asp.net core`
- Marked `AuthHeader Redirect` tests as `Pending` due to change in CoreFX
2018-05-02 16:58:39 -07:00
Christoph Bergmeister 16e1823e33 Packaging: Add registry keys to support library folder background for explorer context menu (#6784)
Fixes #6590 by adding registry keys to support the existing explorer context menu also when being inside a library folder. It follows the existing pattern that was already applied to special cases such as drives, Desktop, etc.
Manually Tested on Win 10 1709
Thanks to @mklement0 for triaging the issue and already researching the required registry key (he should also be included in the release notes)
2018-05-02 14:43:25 -07:00
Dan Travison 385cc1b796 Disallow Basic Auth over HTTP on Unix (#6787)
Disallow Basic Auth over HTTP on Unix

Fix: #6779
2018-05-02 14:29:10 -07:00
Steve Lee 77d10e969e Fix Format-Table where rows were being trimmed unnecessarily if there's only one row of headers (#6772) 2018-05-02 17:59:48 +05:00
Aditya Patwardhan c51a6e38cf
Fix test and infrastructure blocking code coverage runs (#6790)
* Fix Remove-Item test to use a test directory instead of relying on pre-existing directory
* Increase timeout as we are regularly going over it.
2018-05-01 17:28:57 -07:00
Andrew 0e8665dfc0 Updated Docker package tests, fixed error on opensuse42 (#6783)
This PR addresses minor issues with PS-package docker tests.

Historically rpm package version string was different from other packages, however, this is no longer the case, so updating tests to account for that (to simplify things - removing RPM-version parameter from dockerfiles because it is no longer used).
Configs that use 'linux-x64.tar.gz' (currently only "opensuse42.2") are failing, so fixing that in the script.
2018-05-01 10:38:43 -07:00
Bryan Harmat 03b1f2bb99 tools: fix comparison to see if sudo test is needed in install-*.sh (#6771)
The comparison to test if we were using sudo was failing when running as root. We would then run -v, and get a bad error message. fixing the comparison.
2018-05-01 10:35:19 -07:00
Robert Holt 9ca059dcf8 Revert changes from PR #6600 which cause a regression in drive behavior (#6751)
This reverts the commit 35d8de927b, which caused a regression in drive behavior where drive paths were not restored. See issue #6749.
2018-04-30 15:25:11 -07:00
Klaudia Algiz bee98547e4 Fix Select-Object.Tests.ps1 which might fail for Unix OS. (#6747)
Fix Select-Object.Tests.ps1 which might fail for Unix OS.
In the test, the processes which name matches i* are selected and it checks if there is non zero number of these processes. The test assumes that there is always at least one process, probably `init` - idle, but on Unix idle process does not have the name and hence the test might fail
2018-04-30 13:09:16 -07:00
Dongbo Wang 1f9e9d243d Update 'Get-ChangeLog' to make it more accurate (#6764)
Update 'Get-ChangeLog' to make it more accurate

Use "||" as the delimiter instead of "|", so it works for commit message that has the pipeline operator in it.
Handle merges that create a merge node in history.
Do not treat powershell team members as external contributors.
2018-04-30 13:00:28 -07:00
Robert Holt 0c3f429780 Add tests for PowerShell classes inheriting from abstract .NET classes (#6752) 2018-04-30 10:17:20 -07:00
Dongbo Wang 8aec158519
Clean up uses of CommandTypes.Workflow and WorkflowInfo (#6708)
[breaking change] Clean up code related to the uses of `CommandTypes.Workflow` and `WorkflowInfo` in `System.Management.Automation`. This change mainly affects help provider code.

This PR includes a few minor breaking changes:
- Change the `public` constructors of `WorkflowInfo` to `internal`. We don't support workflow in PSCore, so I think it makes sense to not allow people to create `Workflow` instances.
- Remove the type `System.Management.Automation.DebugSource` since it's only used for workflow debugging.
- Remove the overload of `SetParent` from the abstract class `Debugger` that is only used for workflow debugging.
- Remove the same overload of `SetParent` from the derived class `RemotingJobDebugger`.
2018-04-27 23:02:15 -07:00
Sergey Vasin 24069241bc Fix CimCmdlets tests. (#6755) 2018-04-28 09:48:13 +05:00
Aditya Patwardhan 64050a4687 Added Publish-NugetToMyGet to exported functions in psd1 (#6763)
Added the missing export for Publish-NugetToMyGet.
2018-04-27 16:26:13 -07:00
Dongbo Wang aac9467061
Fix preview download links in README.md (#6762)
Replace `~` with `-` for preview download links in README.md
The file names have `~` in them, but when uploading files to Github, `~` will be automatically replaced. So we use `-` for the packages uploaded to Github.
2018-04-27 15:53:50 -07:00
Klaudia Algiz e9b045e819 Update Start-PSPester and Restore-PSPester cmdlets in build.psm1 to check for Pester 4.2 (#6667)
Update Start-PSPester and Restore-PSPester cmdlets in buil.psm1 to check for Pester 4.2 to support exception passthru.
2018-04-27 15:34:54 -07:00
Dongbo Wang 5fd0d6962b
Merge the release branch of v6.1.0-preview.2 to master 2018-04-27 14:22:23 -07:00
Aditya Patwardhan 2c3177a08d Add tests for PowerShell hosting API to verify MyGet packages (#6737) 2018-04-27 13:25:33 -07:00
Dongbo Wang c5415d31a6
Change line ending from CRLF to LF in Microsoft.PowerShell.Management.psd1 (#6758) 2018-04-27 11:05:24 -07:00
Dongbo Wang 9e59bc122a Update the preview version to 6.1.0-preview.2 in README.md 2018-04-27 00:54:42 +00:00
Dongbo Wang daf1accfb4 Update ChangeLog.md for 6.1.0-preview.2 release 2018-04-27 00:04:53 +00:00
Travis Plunk 768cfc4adf
Add script to create a container manifest (#6735)
Add script to create a container manifest
2018-04-26 10:03:53 -07:00
Ilya ffa7e4bac0 Enhance and refactor Add-Type cmdlet (#6141)
- Can compile a source from strings (TypeDefinition and MemberDefinition).
- Can compile from files.
- Can compile only to a file (without loading the produced assembly).
- Do not recompile and don't reload if the sources have not changed.
- Implement `-IgnoreWarnings` to not treat warnings as errors. By default, the cmdlet considers warnings as errors.
- Add VisualBasic support.
- Add new `-CompilerOptions` parameter to allow setting Roslyn command line parameters including:
    - Parser options.
    - Compile options.
    - Emit options.

**ATTENTION:** The `CompilerOptions` can be specified along with other options like `-OutputAssembly`, `-Language` and `-IgnoreWarnings`. The explicit setting parameters will take precedence over the same settings specified in `-CompileOptions`.

See docs about the compiler options:
https://github.com/dotnet/roslyn/blob/master/docs/compilers/CSharp/CommandLine.md
https://github.com/dotnet/roslyn/blob/master/docs/compilers/Visual%20Basic/CommandLine.md

**ATTENTION:** `-OutputType` default is `Library`. If `-OutputType` is absent the `-OutputType` default overlaps a value in `CompileOptions`. In other words output type ("target" ot "t" in command line) is always ignored in `CompileOptions`. We have to use `-OutputType` to set an output type.
2018-04-25 22:40:26 -07:00
Robert Holt 63c0d8d783 Add error handling for interactive #requires (#6469) 2018-04-25 18:04:04 -07:00
Klaudia Algiz 4b149e4191 Use new Pester syntax for Pester tests in module PSDesiredStateConfiguration (#6622) 2018-04-25 17:29:40 -07:00
Klaudia Algiz 045e036205 Update documentation on how to write tests verifying errors conditions (#6687) 2018-04-25 17:26:24 -07:00
Dan Travison 9a2382b67c Update PSRP/Linux NuGet package version to 1.4.2-* (#6711) 2018-04-25 15:48:38 -07:00
Matthew Bobke 35d8de927b Fix New-Item to work correctly when given path is drive root and $PWD is a sub folder of the drive root. (#6600) 2018-04-25 14:32:57 -07:00
Dongbo Wang 95aa40ee64 Expose 'Expand-PSSignedBuild' from packaging module 2018-04-25 11:51:50 -07:00
Ilya a9781dedc2
Add some optimizations in formatting subsystem (#6678)
Use safe pattern 'columns <= columnsThresHold ? stackalloc int[columns] : new int[columns];'
Remove duplicate code.
Use common 'columnsThresHold' constant.
2018-04-25 13:23:28 +05:00