Repository navigation
Test-Connection: Increase output detail when performing a tcp test - #11452
Travis Plunk (TravisEz13) merged 51 commits into
Conversation
…o TestConnection-AddVerboseTcpTest
Rain Sallow (/u/ta11ow) (vexx32)
left a comment
There was a problem hiding this comment.
Great work here!
A few minor things I think we should address but on the whole this looks like a great improvement 😊
Rain Sallow (/u/ta11ow) (vexx32)
left a comment
There was a problem hiding this comment.
Couple smaller things I noticed on a re-read. 🙂
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
Steve Lee (@SteveL-MSFT) Thank you for the update! I've made the changes to implement the parameter sets you've described. As mentioned, the default return with Please let me know if these changes align with what's expected 😁 |
|
Commenting to bump, is there anything else required to merge these changes? I'm very excited to move things forward! |
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
/azp run PowerShell-CI-windows |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
Travis Plunk (@TravisEz13) The documentation for this cmdlet needs to be updated. Please file a docs issue. |
|
🎉 Handy links: |
…owerShell#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>
Test-Connection: Increase output detail when performing a tcp test
These changes provide more detail when using
Test-Connectioncmdlet with the-TCPPortoption. This will provide functionality more in line with the ping test, and the classicTest-NetConnectioncmdlet.Currently, the returned value when performing this test is a boolean true / false. This provides some insight into if the connection was successful but not much else.
Here's the current output:
Here is an example of the same command, with the changes:
The
-Countand-Repeatoptions are also implemented, as seen below:To provide a boolean output, the
-Quietoption is used:Most of the code changes are implementing a new TcpTestStatus class to facilitate the output. A few changes to existing code to implement the existing switches.
PR Context
This opens up a lot more functionality with
Test-Connectionwhen working with TCP. Often, while working on connectivity issues, we need more detail than just if the connection is established, or not.These changes should provide much of the fundamental TCP functionality from the classic
Test-NetConnection.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.Fix: #11440