Commit graph

1072 commits

Author SHA1 Message Date
Mark Kraus 65cf571b54 Replace httpbin.org/encoding Tests with WebListener (#4869) 2017-09-22 10:09:49 -07:00
Dongbo Wang c9cf843302 Fix a test issue that causes tests to be skipped in Travis CI run (#4891) 2017-09-21 11:54:48 -07:00
Ilya 93dc591025 Add 'ArgumentCompletionsAttribute' to support more argument completion scenarios (#4835)
- Add 'ArgumentCompletionsAttribute' to support argument completion for parameters that cannot have a ValidateSetAttribute.
- Use 'ArgumentCompletionsAttribute' for the '-Format' parameter of 'Get-Date' to enable useful argument compeltions.
2017-09-21 10:52:21 -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
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
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
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
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
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
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
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
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
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 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
Dongbo Wang 0dc575dbf6 Disable a failing test case in AppVeyor daily run (#4806) 2017-09-11 10:54:57 -07:00
Dongbo Wang b2fa0ee522 Add tests for StaticParameter to improve coverage (#4779) 2017-09-11 08:54:35 -07:00
Steve Lee 2761c3ff21 Increase Set-Service and New-Service test coverage (#4785)
* reformatted file to be consistent

* manual fix formatting
2017-09-09 20:19:16 +04:00
Ilya fc9d798b77 Enable use 'Singleline,Multiline' option in split operator (#4721)
Fix #4712
2017-09-08 09:23:38 -07:00
Sarith Sutha f4b075c856 Add -WhatIf switch to Start-Process cmdlet (#4735)
* Add -WhatIf switch to Start-Process cmdlet
* Add test for the -WhatIf switch 

* Added a test to ensure that using a whatif switch prevents the action from being performed.

* Incorporated code review comments

* merged two tests into one as suggested

* Included the error action at the end of the cmdlet

* Remove extra space before `StringUtil` and new line

* Renamed the resource string id ProcessStartInfo to StartProcessTarget
2017-09-08 09:18:13 +04:00
Mark Kraus f41461825a Replace httpbin.org/get tests With WebListener (#4738)
* Adds the /Get/ functionality to Weblistener
* Replaces the tests that rely on httpbin.org/get with WebListener


* [Feature] Move HttpBin/Get Tests to WebListener

* [Feature] update .spelling

* [Feature] Address PR Feedback

* [Feature] Add and document Home & /

* Readme Update

* [Feature] Should Match -> Should Be

Rerun CI

* [Feature] Rebase and Rerun CI
2017-09-08 07:53:04 +04:00
Ilya 3c597367ba Replace 'Windows PowerShell' with 'PowerShell' in resx files (#4758)
Replace 'Windows PowerShell' with 'PowerShell' in '.resx' files where appropriate.
2017-09-07 12:33:56 -07:00
Steve Lee 7c9b188c13 Rename $IsOSX to $IsMacOS (#4757) 2017-09-07 10:34:40 -07:00
James Truher [MSFT] ee0bb15b71 Make it easier to view and compare code coverage for a file (#4764) 2017-09-06 17:11:50 -07:00
Dan Travison 7faf76b9c9 Disable test "Test 01. Standard Property test - all properties (<property>)" due to missing CsPhysicallyInstalledMemory (#4763) 2017-09-06 15:14:40 -07:00
Dongbo Wang 41f12b1d2c Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets (#4709)
When dotting a script cmdlet, the locals of automatic variables from the `PSScriptCmdlet` is not set up in the current scope before parameter binding. The fix is to push the locals in `CommandProcessor.OnSetCurrentScope` and pop them in `CommandProcessor.OnRestorePreviousScope`, which will be called from `SetCurrentScopeToExecutionScope` and `RestorePreviousScope` respectively.

Summary of changes:
1. When a new local scope is used, currently we set the locals for `CommandProcessor` right before parameter binding (in `BindCommandLineParametersNoValidation`); we set the locals for `ScriptCommandProcessor` in `Prepare`. I moved both to the constructor, right after the new scope is created so that the code is more consistent.

2. In `CmdletParameterBinderController.cs`, we set up the `PSBoundParameters` and `MyInvocation` variables in `HandleCommandLineDynamicParameters` again, which I think is unnecessary because this method is only called from `BindCommandLineParametersNoValidation`, where the setup is done for the first time.

3. Currently, the locals will be set for dotted script cmdlet in `EnterScope()` and `ExitScope()`. Now, that logic is moved to `OnSetCurrentScope` and `OnRestorePreviousScope` of `CommandProcessor`. This not only makes sure that locals are set before parameter binding, but also is consistent with the `ScriptCommandProcessor`.
2017-09-06 10:25:33 -07:00
James Truher [MSFT] 5d0a1c1a7f get tests to display the same number of tests regardless of platform (#4728)
* Make count of tests the same between Windows and Non-Windows platforms

Change logic so test cases are created for all platforms, but only load the helper module on windows

* Ensure Get-ComputerInfo tests run the same number of tests regardless of platform
2017-09-05 11:17:57 -07:00
Steve Lee fb286e6cf8 Removed double spaces from .cs and .ps1 files (#4743) 2017-09-04 19:45:51 -07:00
Steve Lee efa320cdf8 Update docs about the pull-request-process (#4710)
Update pull-request-process to clarify role/responsibility of author and reviewers based on recent feedback from team and community. Also moved it to `.github/CONTRIBUTING.md` so that all related information can be found at one place.
2017-09-04 10:29:20 -07:00
Ilya fb67072479 Fix error message in ValidateSetAttribute ValidateElement() (#4722) 2017-09-04 09:11:47 -07:00