Commit graph

5240 commits

Author SHA1 Message Date
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
Steve Lee 6f1c7a05c6 Enable cross compiling for raspberry-pi arm32 (#4742) 2017-09-11 12:16:58 -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 db33d90479 First round of workflow cleanup (#4777)
This round of cleanup focuses on the following areas
- Tab completion code
- InitialSessionState
- Compiler/MiscOps
- Utils/SessionStateFunctionAPIs
Changes in the rest affected files are mainly some corresponding changes due to the cleanup work in the above areas.
2017-09-11 08:55:13 -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
Dongbo Wang ca1d2acfba Update coding guidelines (#4754)
* Update coding guidelines to make it more concrete and useful in a review process.

* Add a section about security

* Address comments

* Update .spelling

* Address more comments

* Address comment about the security section

* Fix 'i.e.' and 'e.g.'

* Update .spelling

* One more tweak

* Add motivation for using 'nameof'
2017-09-08 20:24:26 +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
Ilya e588a18c76 Refactor MSBuild project files to get PowerShell version from git tag (#4182)
Extract information about the release tag, number of commits since the tag and the hash of the latest commit within a MSBuild target, and bake that information into version properties of the assemblies appropriately.
2017-09-06 15:20:25 -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
Travis Plunk 955e01dc65 update opensuse docker image to 42.2 (#4737)
- fix missing dependency in amazonlinux dockerfile
- change opensuse docker to use supported image
- update to conform withe label-schema.org
2017-09-05 15:36:29 -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
James Truher [MSFT] cfb2913a29 Modify travis build to upload a daily build based on platform (#4689)
change README.md to view a platform specific badge
2017-09-05 11:11:47 -07:00
Dongbo Wang 5f60058c22 Update using-vscode.md (#4736)
The setting 'powershell.developer.powerShellExePath' is deprecated and should be changed to 'powershell.powerShellExePath'.
2017-09-05 09:21:30 -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
Kory Gill c14648e7a8 Remove double spaces between words in resx files (#4741) 2017-09-03 20:48:08 +04:00
Steve Lee 2f34009328 added new approved Build and Deploy verbs (#4725)
- Added Build and Deploy verbs, updated suggestions
- Reorganized verbs to be in alphabetical order making it easier to compare against https://msdn.microsoft.com/en-us/library/ms714428(VS.85).aspx
2017-09-01 17:41:07 -07:00
Michael Klement 803395b959 Fix for Get-Content -Delimiter including the delimiter in the array elements returned (#3706) - formatting changes 2017-09-01 13:01:43 -07:00
Michael Klement 1de749fbaa Fix for Get-Content -Delimiter including the delimiter in the array elements returned (#3706) - functional changes 2017-09-01 13:01:43 -07:00
Chunqing Chen 87e1d55f45 Set Redist test pending to unblock daily build failure (#4729) 2017-09-01 11:53:17 -07:00
Ilya 58a296ed49 Ensure GetNetworkCredential() returns null if PSCredential has null or empty user name (#4697)
* GetNetworkCredential() returns null if PSCredential has empty user name

* Fix test
2017-09-01 11:50:15 -07:00
Mark Kraus 87db370a59 Move WebCmdlets HTTPS tests to WebListener (#4733)
* Move HTTPS tests to WebListener

* Move Invoke-WebRequest HTTPS Tests to Context

* [Feature] Move Invoke-RestMethod HTTPS Tests to Context

.

* [feature] Address PR Feedback

* [feature] Mark Cert Auth Tests Pending

-skip -> -pending
2017-09-01 22:31:15 +04:00
Andrew deaa7c9375 Trace-Command tests for code coverage (#4288)
Added tests for Trace-Command that increase code coverage to 80%~85% per class.
2017-09-01 09:08:17 -07:00
Chuck Lu fab00865e8 Add absolute url for md in issue template and pull request template (#4718) 2017-09-01 09:04:37 -07:00
Dongbo Wang 795de73d31 Fix 'using module' when module has non-terminating errors handled with 'SilentlyContinue' (#4711)
`Compiler.LoadModule` assumes that when `ps.HadErrors == true` the error stream is not empty. However, when `SilentlyContinue` is specified as the error action, the non-terminating error is not kept in `ErrorOutputPipe` of the cmdlet and thus does not appear in `ps.Streams.Error`. So when `ps.HadErrors == true` while `ps.Streams.Error` is empty, it suggests it's OK to ignore the errors because they are explicitly suppressed with `SilentlyContinue` error action.

So in my opinion, the expected behavior of `"using module .\mod.psm1"` in this case should be successful as if `ps.HaddErrors` is false.
2017-09-01 08:54:08 -07:00
James Truher [MSFT] e0b7c23384 Report the same number of tests when run by Travis via cron (#4731) 2017-08-31 15:03:20 -07:00
Dan Travison 96a90f8985 Add explicit ContentType detection to Invoke-RestMethod (#4692)
This change removes the call to `ContentHelper.GetEncoding` since it's logic for returning a default encoding when a ContentType header is not found disables subsequent checks for meta charset definitions.
All variations of the Invoke-WebRequest tests have been mirrored for Invoke-RestMethod. Verbose output is used to verify the encoding since Invoke-RestMethod returns the JSON content directly instead of a response object. (See ExecuteRestMethod)
2017-08-31 10:47:54 -07:00
Mark Kraus 3b2d169c5e Add test WebListener module and tests for Web Cmdlet Certificate Authentication (#4622)
Introduce new test module 'WebListener.psm1'.
Now web HTTPS tests can use it to exclude using external sites.

PowerShell/PowerShell#4609

* [Feature] Add Tests for Web Cmdlet Certificate Authentication

PowerShell/PowerShell#4609

* [feature] Add new app to Publish-PSTestTools refactor tests

also add ASP.NET to .spelling

* [feature] spelling fix

* [feature] revert badssl changes

* [feature] Impliment suggestions

* [feature] Spelling, var rename, port 8443 to 8083

rebase fix conflict

* [feature] Rename to HttpsListener and Module-ize

.

* [feature] password protect ClientCert to fix macOS import issue

* [feature] Rename to WebListener 

* Rename HttpsListener to WebListener
* Switch Listener from Razor pages to MVC
* Address PR feedback
* Adjust tests

* [feature] Address PR feedback

* [feature] Replace missing smeicolons

* [feature] Address PR Feedback

* [feature] Cleanup and minor fix

* Enum was not used
* GetStatus() was not accessing the correct property chain
* Added -Test param to make URL generation smoother in test code and to fix double / issues

* [feature] More minor fixes

* Https when it matters.
* Expand property... not exclude..
* Remove superfluous and outdated ToString() override

* [Feature] Move ClientCeret.pfx to WebListener Module

* Move the cert
* Adjust Get-WebListenerClientCertificate 
* Remove cert from csproj
* ActionResult -> JsonResult (was mistakenly left as ActionResult during testing)..

* [Feature] Move ServerCert.pfx to Module

* Move cert
* Upate csproj
* Update module
* Add/Update README.md's

CI Retest.
2017-08-31 13:30:35 +04:00
Travis Plunk bd42fe95b4 change the default windows RID to win7-<arch> (#4701) 2017-08-29 17:21:50 -07:00
Steve Lee dc399a121b clean up coreclr/fullclr statements in tracesource (#4684) 2017-08-29 09:09:24 -07:00
Aditya Patwardhan fd047a8250 Creates a single package for Windows (#4540)
The updates to build.psm1 and packaging.psm1 create a single package (per bitness), which works on all the Windows OS versions, namely Windows 7 / Windows Server 2008 R2, Windows 8.1 / Windows Server 2012 R2, Windows 10 / Windows Server 2016.
2017-08-28 16:10:03 -07:00
Steve Lee deb8c4485d Remove alternate file stream code from non-Windows (#4567)
* AlternateStreams support relies on pinvoke to win32 APIs which don't work on non-Windows and produces errors about not loading a DLL in the case of copy-item
* Address PR feedback, remove -Stream parameter for Unix added new -stream tests
* if/def out alternate stream syntax checks not applicable to Unix
2017-08-28 15:39:42 -07:00
Chunqing Chen fe51fb7f60 Make 'Test-ModuleManifest' not load unnecessary modules (#4541) 2017-08-28 15:36:46 -07:00
Dongbo Wang 12002e7f2d Use stricter rule to unwrap a PSObject that wraps a COM object (#4614)
GetMember/SetMember/InvokeMember operations on a COM object will generate code to unwrap the COM object if it's wrapped in PSObject. Due to a loose restriction, if you have a string wrapped to a PSObject with an ETS member of the same name, then the string PSObject will be unwrapped too and the ETS member will be lost. The fix is to use a more restricted rule by checking if the base object is a COM object.
2017-08-28 13:19:02 -07:00