Commit Graph
1144 Commits
Author SHA1 Message Date
Steve Lee 7888196b87 Add specific error message that creating Junctions requires absolute path (#19409) 2023-05-09 08:37:28 -07:00
xtqqczze d314b0b1c0 Fix incorrect test cases in ExecutionPolicy.Tests.ps1 (#19485) 2023-05-09 00:12:07 +00:00
mkht 9502931493 Fix HTTP status from 409 to 429 for WebCmdlets to get retry interval from Retry-After header. (#19622) 2023-05-08 15:57:27 -07:00
Greg Dennis 1b248efb3f Test-Json: Use JsonSchema.Net (System.Text.Json) instead of NJsonSchema (Newtonsoft.Json) (#18141)
Updates the Test-Json cmdlet to use JsonSchema.Net instead of NJsonSchema in order to:

- use System.Text.Json instead of Newtonsoft
- support the latest JSON Schema drafts (up to 2020-12)
2023-05-04 08:19:32 +05:00
07e041fe10 Allow combining of -Skip and -SkipLast parameters in Select-Object cmdlet. (#18849)
* Added SkipLast parameter set to Skip parameter and updated tests

* Using Should -BeExactly with string

* Update test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1

---------

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Co-authored-by: Travis Plunk <github@ez13.net>
2023-05-02 13:07:32 -07:00
Steve LeeandJames Truher [MSFT] a153446a01 Add Get-SecureRandom cmdlet (#19587)
* Add `Get-SecureRandom` cmdlet

* update comments

* address Paul and Travis' comments

* Update test/powershell/Modules/Microsoft.PowerShell.Utility/Get-SecureRandom.Tests.ps1

Co-authored-by: James Truher [MSFT] <jimtru@microsoft.com>

* address codefactor

* address Ilya's feedback creating a base class for both cmdlets

* remove unused `using`

---------

Co-authored-by: James Truher [MSFT] <jimtru@microsoft.com>
2023-05-02 10:54:39 -07:00
Olivia 05fbceb48c Fix New-Item to re-create Junction when -Force is specified (#18311) 2023-05-02 09:36:33 -07:00
Jack CaseyandTravis Plunk 698742ea9f Test-Connection: Increase output detail when performing a tcp test (#11452)
* Added verbose TCP test logic

* Cleaned up output, removed source IP address

* Consolidated detailed output logic into ProcessConnectionByTCPPort()

* Updated existing tests with -Quiet switch

* Improved output formatting, changed logic to match

* Error handling and logic improvements

* Updated tests to match new output

* Updated logic, tcp tests now run once by default

* Moved TcpConnectionTestResult enum into TcpTestStatus class

* Removed unnecessary whitespace

* Wrapped TcpClient() in Using statement

* Appended missing period on comments

* Change TcpTestStatus to TcpPortStatus for better clarity

* Set default count back to 4

* Move stopwatch reset into finally block

* Change TcpConnectionTestResult.New to TcpConnectionTestResult.None

* Formatting fixes

* Increase column size for Result output

* Update logic for -quiet option

* Change "TestNum" property to "Id"

* Change Destination and DestinationAddress to Target and TargetAddress in TcpPortStatus

* Implement new form of using declaration

* Fix indentation

* Update output, improve logic and update tests

* Add CancellationToken to allow cancel before timeout

* Assign testResult.Connected to client.Connected

* Move TcpPortStatus object creation to after connection test

* Remove delay from final connection test in loop

* Move Count logic from ProcessConnectionByTCPPort into own function

* Fix small formatting error

* Add handling for TaskCanceledException

* Remove redundant CancellationToken getter

* Clean up handling of SocketException

* Increase readability of final loop check

* Remove unnecessary TimeSpan invocation

* Rename cancellationTokenSource to match convention

* Move SetCountForTcpTest() into BeginProcessing()

* Added nameof to Count check

* Removed explicit type declaration for TcpClient

* Move delay and timeout evaluation out of the cycle

* Remove redundant CancellationTokenSource

* Initialize detailed SwitchParameter

* Add check for Detailed parameter

* Remove redundant tests for non-detailed output

* Add return after first boolean output

* Update tests with new detailed parameter set

---------

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2023-05-01 14:16:11 -07:00
Aditya Patwardhan cf6fc53c9f Fix test failures on Windows for time zone and remoting (#19466) 2023-04-25 11:06:34 -07:00
stevenebutler 319c9faf57 Improve reliability of the Ctrl+c tests for WebCmdlets (#19532) 2023-04-20 09:40:01 -07:00
Dongbo Wang 8ed8b52700 Fix a race condition in Add-Type (#19471) 2023-04-12 21:41:43 -07:00
CarloToso 3dd943d212 Detect insecure https-to-http redirect only if both URIs are absolute (#19468) 2023-04-12 00:56:24 +00:00
stevenebutler 17fb783736 Support CTRL-C when reading data and connection hangs for Invoke-RestMethod and Invoke-WebRequest (#19330) 2023-04-03 23:08:35 +00:00
Aditya Patwardhan 5a22587792 Skip VT100 tests on Windows Server 2012R2 as console does not support it (#19413) 2023-03-27 17:36:41 -07:00
James Truher [MSFT] 7ee22063c5 Improve package management acceptance tests by not going to the gallery (#19412) 2023-03-27 14:54:53 -07:00
Steve Lee 2553a56db2 Add -Environment parameter to Start-Process (#19374)
* Add `-Environment` parameter to `Start-Process`

* address codefactor

* fix test for Windows

* handle case where value is $null to remove env var

* change variables to make it more clear what the test is doing
2023-03-27 11:05:04 -07:00
MartinGC94 48c9d68356 Add the parameter -RelativeBasePath to Resolve-Path (#19358) 2023-03-22 16:44:48 -07:00
CarloToso 5b1dedac61 Allow using a folder path in WebCmdlet's OutFile parameter (#19007) 2023-03-21 13:06:50 +05:00
Aditya Patwardhan e95f7fb50f Test fixes for stabilizing tests (#19068) 2023-03-13 15:40:27 -07:00
CarloToso 9a2d2afb64 Make -Encoding parameter able to take ANSI encoding in PowerShell (#19298) 2023-03-13 15:05:28 -07:00
stevenebutler 9e341148f4 Support HTTP persistent connections in Web Cmdlets (#19249) 2023-03-07 09:42:08 -08:00
CarloToso 6824d489bb Fix using xml -Body in webcmdlets without an encoding (#19281) 2023-03-07 09:35:36 +05:00
CarloToso 8b9544b614 Adjust PUT method behavior to POST one for default content type in WebCmdlets (#19152) 2023-03-02 23:35:31 +05:00
CarloToso f1ab653d29 Preserve WebSession.MaximumRedirection from changes (#19190) 2023-03-02 00:04:20 +05:00
CarloToso cf622f869f Take into account ContentType from Headers in WebCmdlets (#19227) 2023-03-01 22:56:05 +05:00
Armaan Mcleod 0be3eeac38 Add -Path and -LiteralPath parameters to Test-Json cmdlet (#19042) 2023-02-21 10:14:08 -08:00
CarloToso 60b4e9704f Allow to preserve the original HTTP method by adding -PreserveHttpMethodOnRedirect to Web cmdlets (#18894) 2023-02-14 08:40:42 -08:00
CarloToso 69a4d79400 Webcmdlets display an error on https to http redirect (#18595) 2023-02-14 08:32:48 +05:00
CarloToso 2f43013df3 Build the relative URI for links from the response in Invoke-WebRequest (#19092) 2023-02-10 21:50:01 +05:00
CarloToso ed68c861d4 Fix redirection for -CustomMethod "POST" in WebCmdlets (#19111) 2023-02-10 16:14:29 +05:00
CarloToso 359f5c35f1 Improve Invoke-WebRequest xml and json errors format (#18837) 2023-02-09 13:22:04 +05:00
Armaan Mcleod b7e2913f6f Add -NoHeader parameter to ConvertTo-Csv and Export-Csv cmdlets (#19108) 2023-02-08 17:48:04 +05:00
CarloToso dd406b512a Add ValidateNotNullOrEmpty to OutFile and InFile parameters of WebCmdlets (#19044) 2023-02-01 21:45:09 +05:00
Travis PlunkandAditya Patwardhan b2c4888ebb Add Windows ARM64 CI (#19040)
* Add CI for win-arm64

* Add common function to test for windows arm64

* Update because string where items need investigation

---------

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2023-01-31 12:06:29 -08:00
Aditya Patwardhan f8cbf90ccb Fix progress calculation divide by zero in Copy-Item (#19038) 2023-01-27 10:03:19 -08:00
CarloToso 282fc5fc08 Fix bug with managing redirection and keepAuthorization in Web cmdlets (#18902) 2023-01-13 18:31:03 +05:00
Steve Lee 2baeb1a7f0 Fix Get-Error to work with strict mode (#18895) 2023-01-13 18:00:20 +05:00
CarloToso f018beedff Add tests for Allowinsecureredirect parameter in Web cmdlets (#18939) 2023-01-13 17:37:55 +05:00
CarloToso 465165fd97 Invoke-RestMethod -FollowRelLink fix links containing commas (#18829) 2023-01-11 21:39:04 +05:00
CarloToso 31af38c22a Create test to check if WebCmdlets decompress brotli-encoded data (#18905) 2023-01-10 08:07:00 +05:00
Steve Lee f04940b76c Fix Format-Table -RepeatHeader for property derived tables (#18870) 2022-12-31 12:00:00 +05:00
Steve Lee eb9ca7c351 Fix New-Item -ItemType Hardlink to resolve target to absolute path and not allow link to itself (#18634) 2022-12-13 22:09:28 +05:00
Ilya e7c68af8bb Enable pending test for Start-Process (#18724) 2022-12-12 11:26:27 -08:00
Jordan Borean 6fa7260db9 Fix the process CommandLine on Linux (#18710) 2022-12-02 10:23:00 -08:00
Steve Lee 8ff6a06f97 Switch $PSNativeCommandUseErrorActionPreference to $true when feature is enabled (#18695) 2022-12-01 16:13:42 -08:00
Ilya 8bc9fdb2a1 Replace DllImport with LibraryImport in SMA 2 (#18543) 2022-11-22 22:22:14 +05:00
Steve Lee 9ae18ab0d1 Change exec from alias to function to handle arbitrary arguments (#18567) 2022-11-17 12:14:27 -08:00
Travis Plunk 9c55989a2e Mark charset test as pending (#18511) 2022-11-09 23:04:21 +00:00
Steve Lee 0ddf89e5a8 Fix Switch-Process to copy the current env to the new process (#18452) 2022-11-07 11:03:37 -08:00
Steve Lee 52a62e9ef2 Fix Switch-Process error to include the command that is not found (#18443) 2022-11-03 07:54:11 +05:00