-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Changes since 2.2.2:** - Fix a GCM/Git Trace2 file locking issue - Issue: #1323 - PR: #1340 - Remove symlinks to `git-credential-manager-core` exe - Issue: #1322 - PR: #1327 - Add fallback http uri to `diagnose` command - Issue: #1215 - PR: #1339 - Workaround MSAL tenant issue with silent auth - Issue: #1297 - PR: #1321
- Loading branch information
Showing
17 changed files
with
204 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.2.0 | ||
2.3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Security.AccessControl; | ||
using System.Text; | ||
using GitCredentialManager.Diagnostics; | ||
using GitCredentialManager.Tests.Objects; | ||
using Xunit; | ||
|
||
namespace Core.Tests.Commands; | ||
|
||
public class DiagnoseCommandTests | ||
{ | ||
[Fact] | ||
public void NetworkingDiagnostic_SendHttpRequest_Primary_OK() | ||
{ | ||
var primaryUriString = "http://example.com"; | ||
var sb = new StringBuilder(); | ||
var context = new TestCommandContext(); | ||
var networkingDiagnostic = new NetworkingDiagnostic(context); | ||
var primaryUri = new Uri(primaryUriString); | ||
var httpHandler = new TestHttpMessageHandler(); | ||
var httpResponse = new HttpResponseMessage(); | ||
var expected = $"Sending HEAD request to {primaryUriString}... OK{Environment.NewLine}"; | ||
|
||
httpHandler.Setup(HttpMethod.Head, primaryUri, httpResponse); | ||
|
||
networkingDiagnostic.SendHttpRequest(sb, new HttpClient(httpHandler)); | ||
|
||
httpHandler.AssertRequest(HttpMethod.Head, primaryUri, expectedNumberOfCalls: 1); | ||
Assert.Contains(expected, sb.ToString()); | ||
} | ||
|
||
[Fact] | ||
public void NetworkingDiagnostic_SendHttpRequest_Backup_OK() | ||
{ | ||
var primaryUriString = "http://example.com"; | ||
var backupUriString = "http://httpforever.com"; | ||
var sb = new StringBuilder(); | ||
var context = new TestCommandContext(); | ||
var networkingDiagnostic = new NetworkingDiagnostic(context); | ||
var primaryUri = new Uri(primaryUriString); | ||
var backupUri = new Uri(backupUriString); | ||
var httpHandler = new TestHttpMessageHandler { SimulatePrimaryUriFailure = true }; | ||
var httpResponse = new HttpResponseMessage(); | ||
var expected = $"Sending HEAD request to {primaryUriString}... warning: HEAD request failed{Environment.NewLine}" + | ||
$"Sending HEAD request to {backupUriString}... OK{Environment.NewLine}"; | ||
|
||
httpHandler.Setup(HttpMethod.Head, primaryUri, httpResponse); | ||
httpHandler.Setup(HttpMethod.Head, backupUri, httpResponse); | ||
|
||
networkingDiagnostic.SendHttpRequest(sb, new HttpClient(httpHandler)); | ||
|
||
httpHandler.AssertRequest(HttpMethod.Head, primaryUri, expectedNumberOfCalls: 1); | ||
httpHandler.AssertRequest(HttpMethod.Head, backupUri, expectedNumberOfCalls: 1); | ||
Assert.Contains(expected, sb.ToString()); | ||
} | ||
|
||
[Fact] | ||
public void NetworkingDiagnostic_SendHttpRequest_No_Network() | ||
{ | ||
var primaryUriString = "http://example.com"; | ||
var backupUriString = "http://httpforever.com"; | ||
var sb = new StringBuilder(); | ||
var context = new TestCommandContext(); | ||
var networkingDiagnostic = new NetworkingDiagnostic(context); | ||
var primaryUri = new Uri(primaryUriString); | ||
var backupUri = new Uri(backupUriString); | ||
var httpHandler = new TestHttpMessageHandler { SimulateNoNetwork = true }; | ||
var httpResponse = new HttpResponseMessage(); | ||
var expected = $"Sending HEAD request to {primaryUriString}... warning: HEAD request failed{Environment.NewLine}" + | ||
$"Sending HEAD request to {backupUriString}... warning: HEAD request failed{Environment.NewLine}"; | ||
|
||
httpHandler.Setup(HttpMethod.Head, primaryUri, httpResponse); | ||
httpHandler.Setup(HttpMethod.Head, backupUri, httpResponse); | ||
|
||
networkingDiagnostic.SendHttpRequest(sb, new HttpClient(httpHandler)); | ||
|
||
httpHandler.AssertRequest(HttpMethod.Head, primaryUri, expectedNumberOfCalls: 1); | ||
httpHandler.AssertRequest(HttpMethod.Head, backupUri, expectedNumberOfCalls: 1); | ||
Assert.Contains(expected, sb.ToString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.