Commit graph

5281 commits

Author SHA1 Message Date
Mark Kraus 84ac5218a1 Sort .spelling (#4876) 2017-09-21 10:26:17 -07:00
Mark Kraus 5e24352177 Initialize Headers Dictionary Only Once (#4853)
Switch the  WebResponseObject.Headers Dictionary to initialize once instead of creating a new dictionary on every get. Moved logic to  WebResponseHelper.GetHeadersDictionary()  as this code will be reused outside of  WebResponseObject .

* [Feature] Create Headers Only Once and Only If Called

* {feature] headers -> _headers

* [Feature] Move logic to WebResponseObject for reuse

This code has potential reuse in InvokeRestMethodCommand. Moving it to WebResponseHelper

* Add comment to address PR Feedback.
2017-09-21 12:41:57 +04:00
Dongbo Wang b81aeb4b64 Remove remainder of Utility.Activities (#4880) 2017-09-20 17:27:08 -07:00
Jonas Andersen f281671375 [Feature]Added Remove-service to Management module (#4858)
* [Feature]Remove-Service added to Management module

* [Feature]Capitalization

* [Feature]Added test cases for Remove-Service, Removed return value

* [Feature]Documentation from copy-paste code corrected to reflect the new function

* [Feature]Erroraction to be sure that an error is thrown in testcase

* [Feature]Removed direct reference to module in Pester test

* [Feature]Removed extra line in test

* [Feature]Use FullyQualifiedErrorId in Remove-Service test without a valid servicename

* [Feature]Exposed Remove-Service

* [Feature]Consistent casing, Named Arguments & Remove incorrect exception on cleanup

* [Feature]Remove-Service test should fail if the service was not removed

* [Feature]Cleanup comments & add Remove-Service for CI

* [Feature]Remove-Service in CI set in alphabetic order

* [Feature]Use ParameterSetName instead of _ParameterSetName and rewrite test which used the function class directly

* Revert "[Feature]Use ParameterSetName instead of _ParameterSetName and rewrite test which used the function class directly"

This reverts commit da41f7deb8.

* [Feature]Remove _ParameterSetName check & added test for pipeline input in
Set-Service
2017-09-20 17:24:39 -07:00
Travis Plunk 4c6ad4a133 Revert the changes to Pester from merged PR #4184 (#4881)
That PR incorrectly included Pester changes. Most likely because that individual did not update his submodules.
2017-09-20 16:08:29 -07:00
Steve Lee 646b6a6c41 Add setup steps for MacOS to use PSRP over SSH (#4872) 2017-09-20 15:09:13 -07:00
Dongbo Wang 4c29f5768d Fix bugs with expression redirected to file (#4847)
When handling file redirection for CommandExpression, we don't call 'DoComplete' on the underlying PipelineProcessor of the FileRedirection object, and thus the EndProcessing method is not called on Out-File, which causes different behaviors between <expr> > out.txt and <expr> | Out-File out.txt.

The fix is to make sure 'DoComplete' is called after the stream output has been written to the redirection pipe.

Also fix another issue

This PR also fixes an issue that could mess up restoring the original pipes. Here is the repro:

PS> 1 *> b.txt > a.txt; 123
Cannot perform operation because object "PipelineProcessor" has already been disposed
The root cause is that we don't always restore pipes in the correct order. Please see the code changes in Compiler.cs for more details.

Fix #4812
2017-09-20 14:39:02 -07:00
Staffan Gustafsson 916ef56eeb Call to CodeMethod returning void should work (#4850)
Fixes #4826
2017-09-20 14:37:43 -07:00
Dongbo Wang e71d003749 Minor updates to host-powershell/README.md (#4877) 2017-09-20 14:06:34 -07:00
Steve Lee 9791116979 reduce output of pester for CI (#4855) 2017-09-19 14:56:32 -07:00
Paul Higinbotham 7c8b7eff52 Port tests for constrained language mode (#4816)
* Port tests for constrained language mode
* Added 'RequireAdminOnWindows' for registry access
* Restored Wait-UntilTrue to current state
2017-09-19 14:53:29 -07:00
James Truher [MSFT] fb7c7b038b Only run tests on Windows, otherwise skip them. (#4861) 2017-09-19 13:51:21 -07:00
Jason Shirk de70969f4e Add VS 2017 solution file for powershell-win-core (#4748) 2017-09-18 17:13:29 -07:00
Steve Lee 66552a430f Add CDXML CIM DateTime test (#4796) 2017-09-18 17:10:58 -07:00
Sarith Sutha af798fb644 Add tests for Get-Content (#4723)
* Add tests for Get-Content -Tail #4150

* Incorporated the review comments

* renamed couple of tests

* removed extra spaces

* Tests refactored into a Context and the checks broken down into separate tests

* Made the indents consistent with the other existing tests

* Incorporated the review comments
2017-09-18 16:58:58 -07:00
Steve Lee 23420643e3 Added WSMan Config provider tests (#4756)
* [Feature]
fixed issues in WSMan Config Provider
added tests for get-item, get-childitem, set-item, new-item remove-item, clear-item, dynamic parameters
merged CoreClr and FullClr code

* [feature]
address PR feedback

* [feature]
revert to using microsoft.powershell plugin as base for test
keeps it simple rather than relying on additional scripts or cmdlets since these tests don't require remoting

* [feature]
address Aditya's feedback

* [feature]
address some cosmetic feedback

* [feature]
based on discussion with Jim, we should skip resx checks on non-Windows
2017-09-18 15:44:09 -07:00
Dongbo Wang 192803bfcf Build powershell core using the generic RID 'linux-x64' (#4841) 2017-09-18 09:31:07 -07:00
Mark Kraus a2dd0ca4b5 Replace httpbin.org/redirect Tests with WebListener (#4852) 2017-09-18 09:26:01 -07:00
Dan Travison a3e129c586 Fix tests that incorrectly use ShouldBeErrorId (#4793) 2017-09-18 09:24:55 -07:00
James Truher [MSFT] 0229451148 Validate product resource strings against resx files (#4811) 2017-09-18 09:20:46 -07:00
Dan Travison 0770746e7d Add tests for Get-Content -Tail parameter (#4790) 2017-09-18 08:51:36 -07:00
Jonas Andersen b7ec5da216 Added functionality to set credientials on Set-Service command (#4844)
Now we can specifiy the -Credential parameter on Set-Service cmdlet to change a service's logon account.
2017-09-18 14:23:17 +04:00
Lucas Spits 03e3257b0a Updated default ModuleVersion in ModuleManifest (#4842)
* Updated default ModuleVersion in ModuleManifest to 0.0.1

* updates tests where manifests default versions where still matched agianst the old 1.0 version
2017-09-15 11:44:07 -07:00
Steve Lee b723d6b7f2 fix set-service failing test (#4802)
* Add '-ErrorAction Stop' in Set-Service.Tests.ps1 to correctly test exceptions.
* Refactor StartupType service code and add a throw for disabled startup types (System, Boot).
* Made StartupType(-1) equivalent to Win32 SERVICE_NO_CHANGE.
2017-09-15 12:24:40 +04:00
bergmeister da49841f16 Use a simple file based check for the VC++ 2015 redistributables (#4745)
* A simple and minimal fix of 4665 to check for the Visual Studio C++ 2015 redistributables. Note that this is specific to 2015 (vcruntime140.dll refers to the Visual Studio version 14.0, which maps to Visual Studio 2015).
A previous check registry check of 'SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum' failed because when the redistributables are installed via Windows update (which does not use MSI), then the registry entry did not get populated.
The 'Pending' attribute was removed from existing tests since the download links are now present again and the tests were improved using Pester TestCases.

* Fixed typo spotted in code review of PR 4745

* Remove DirectorySearch Id duplication by defining it once and referencing according to this special trick in the official WiX documentation here: http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/directorysearchref.html
Renamed property values as suggested.

* Remove replacements of HTTPS with HTTP, i.e. test against exact link. Use -UseBasicParsing switch with the hope of not having failures in the CI environment.
Added comment why there is no assertion about the StatusCode.

* Replace download links with link to pre-requisites page as suggested in PR 4745 because this page is easier to update

* Compilation error CNDL0012 fix: WiX does not allow lowercase characters for file search property Ids because due to them being used for a search property means that they must be public, hence lowercase is not allowed.
2017-09-14 18:42:36 -07:00
Ilya a4cdb806f4 Exclude directories discovered from '-Path' in Select-String (#4829)
Select-String can search in files only so we should skip directories.
2017-09-14 14:57:17 -07:00
bergmeister d804d7fd30 Make the build output the WiX compilation log if it failed. (#4831)
* Make the build output the WiX compilation log if it failed.
Before it was not outputting it not at all because the build output is an array that was piped directly to 'Write-Verbose' instead of converting it to a string using 'Out-String'
Because the WiX log is usually quite verbose (around 250 lines), the log is only shown if there must have been a compilation error due to the missing MSI

* PR 4831: Use -Verbose option on Write-Verbose to force output in build as suggested in review.
2017-09-14 14:12:51 -07:00
James Truher [MSFT] a9db9ba482 Skip Certificate Authentication tests on CentOS and Mac (#4822)
These two tests have been failing on CentOS for some time. It is because the available libcurl library does not support client authentication certificates
2017-09-14 10:52:35 -07:00
Dongbo Wang ede580e7d1 Improve the guideline for perf consideration (#4824)
* Improve the guideline for perf consideration

* Address comment
2017-09-14 09:24:49 +04:00
Mark Kraus 303a83546b Replace httpbin.org/user-agent with WebListener (#4798)
* Replace httpbin.org/user-agent with WebListener

* [feature] -SkipCertificateCheck To avoid cert issue

* [Feature] Rebase & Rerun CI

Rerun count: II
2017-09-14 09:23:29 +04:00
Mark Kraus 869cdf9ba4 Replace httpbin.org/headers with WebListener Get (#4799)
* Replace httpbin.org/headers with WebListener Get

* [feature] -SkipCertificateCheck to avoid Cert issue

* [Feature] Rebase & Rerun CI
2017-09-14 09:22:52 +04:00
Dongbo Wang 6703014b32 Merge beta.7 release branch to master 2017-09-13 17:24:02 -07:00
Dongbo Wang 6bf0ead8d6 Update windows package names 2017-09-13 16:37:43 -07:00
Travis Plunk ea7c2bddbe Update travis-ci script so that PRs can fail due to pester tests (#4830)
* Add a switch to force tests to fail for testing CI system to Start-PSPester
* [includeFailingTest] Add commit tag to force tests to fail for testing CI system
2017-09-13 14:14:08 -07:00
Steve Lee 5fedd9c54f added tests for start/stop/suspend/resume/restart service cmdlets (#4774) 2017-09-13 10:24:04 -07:00
Steve Lee 4ad313aafb Add tests for Get-Module over remoting (#4787)
Some additional tests that are remoting specific based on code coverage
2017-09-12 17:12:52 -07:00
Mike Richmond d2fe36fb41 6.0.0-beta.7 Change Log (#4821) 2017-09-12 17:10:25 -07:00
Dongbo Wang a86e608c8b Update docs for beta.7 release 2017-09-12 15:08:49 -07:00
Dongbo Wang c06ffc4a5c Add a generic file watcher function in HelpersCommon.psm1 (#4775)
Add a generic file watcher function in HelpersCommon.psm1 and update some tests to use the `Wait-FileToBePresent`.
2017-09-12 13:05:47 -07:00
Dan Travison 6a78e303ff Mitigate intermittent failures in access denied tests. (#4788)
This change mitigates intermittent timeout failures in the access denied tests as well as fixes unintended cross-test dependencies. If PowerShell takes longer that 10 seconds to complete a race can cause the subsequent test to pick up the output file of the previous test and fail (i.e., the expected output error file already exists from the previous test because it was created by the long running PowerShell process after the second test started.) Worse case, the failure cascades causing the race to propagate through the remaining tests in the set.

The fix is two fold:
1: Increase the timeout for waiting for the launched powershell process. (mitigation)
2: Ensure each uses a unique name for the error and done files to avoid polluting the next test.
2017-09-12 11:01:32 -07:00
Mark Kraus fd3a003765 Add Multipart Support to Web Cmdlets (#4782)
Partially implements  #2112
- Adds `System.Net.Http.MultipartFormDataContent` as a possible type for `-Body`
- Adds `/Multipart/` test to WebListener 

This allows for the user to create their own `Http.MultipartFormDataContent` object and submit it. Since `multipart/form-data` submissions are highly flexible, adding direct support for it to the CmdLets may over-complicate the command parameters and a limited implementation would not address the broad scope of use cases. This at least allows the user to submit multipart forms using the Web Cmdlets and not have to manage their own `HttpClient`. Once this is introduced, limited multipart implementations can be expanded to use the code in this PR.
2017-09-12 09:41:36 -07:00
Steve Lee 1e4cbe15ff Added tests for get-service based on code coverage analysis (#4773)
* reformated test cases

* added whitespace to format the test cases
2017-09-12 08:48:37 +04:00
Paul Higinbotham f95b8aca86 [Regression] Fix for error on Enter-PSSession exit (#4693)
* Fix for error on Enter-PSSession exit

* Added comments per code review feedback

* Updated comment
2017-09-11 17:49:28 -07:00
Steve Lee 6b684bb7dd The PSSessionConfiguration tests were putting many repeated warning messages into the log, changed warnings to be silent (#4794) 2017-09-11 17:45:21 -07:00
Travis Plunk fb60c47a1e Fix travis-ci script so that PRs can fail due to pester tests (#4807) 2017-09-11 15:24:09 -07:00
Dongbo Wang ad0b4cc54b Add tests for ProxyCommand APIs to improve coverage (#4791)
Examine the code in ProxyCommand.cs to find out specific missing areas.
2017-09-11 14:06:32 -07:00
Travis Plunk a3e193a6b3 Add tests for 'New-Object -ComObject' (#4776) 2017-09-11 12:53:34 -07:00
Steve Lee 3815a95242 validate the expected output package exists (#4795) 2017-09-11 12:36:24 -07:00
Steve Lee 625717493b added tests for test-wsman (#4771) 2017-09-11 12:31:08 -07:00
Littlejohn bbc180a918 Added Meta, Charset, and Transitional parameters to ConvertTo-HTML (#4184) 2017-09-11 12:22:10 -07:00