I am trying to setup a dotnet core xunit project for my integration testing, it calls our local test server instead of the local host .
Whenever I run my project locally it is working fine .
But when I tried to integrate with circleCI , I am seeing the below exception
Starting test execution, please wait...
Hello
[xUnit.net 00:01:41.45] IntegrationTesting.Test1.LTest1 [FAIL]
Failed IntegrationTesting.Test1.LTest1
Error Message:
System.OperationCanceledException : The operation was canceled.
Stack Trace:
at System.Net.Http.HttpClient.HandleFinishSendAsyncError(Exception e, CancellationTokenSource cts)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at IntegrationTesting.Test1.LTest1() in /root/project/Testing/Test1.cs:line 29
— End of stack trace from previous location where exception was thrown —
Here is the sample code
[Fact]
public async Task LTest1()
{
_client = new HttpClient();
_client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer","asdsada");
Console.WriteLine("Hello");
var response = await _client.GetAsync("https://testServer/api/work");
var testdata = await response.Content.ReadAsStringAsync();
Console.WriteLine(testdata);
}