diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ef213a5e..cf2a6ef5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,8 +44,7 @@ If you want to do clean up all the containers created by the test, execute the ` ## Debugging the functional tests It is important to note that since the test application is deployed as a separate process/container, debugging the tests itself will not help debug the application code. A debugger need to be attached to the process hosting the Application. (IISExpress or IIS) -The test apps refers to the Web SDK assemblies from your local build. After making the changes to product code, build locally (from Visual Studio or using ```buildDebug.cmd```). Then start the test application from its publish -folder in either IISExpress or IIS, and attach debugger to it. Open the .cs file you want your breakpoint in and set it. Now triggering a request to the application will hit the breakpoint. +The test apps refers to the Web SDK assemblies from your local build. After making the changes to product code, build locally (from Visual Studio or using ```buildDebug.cmd```). Then build and start the test application from its publish folder in either IISExpress or IIS, and attach debugger to it. Open the .cs file you want your breakpoint in and set it. Now triggering a request to the application will hit the breakpoint. The exact request to be triggered depends on what you are doing. If investigating functional test failures locally, then the tests logs should contain the url it hit to trigger scenarios. Dependency Collector tests deploy the test apps, along with dependencies (Fake Ingestion, SQL etc) to Docker containers inside same Docker virtual network, so that apps can access the dependencies with their names. However, if diff --git a/Test/E2ETests/E2ETests/Test452Base.cs b/Test/E2ETests/E2ETests/Test452Base.cs index f90fc3a7b..8175eeb0f 100644 --- a/Test/E2ETests/E2ETests/Test452Base.cs +++ b/Test/E2ETests/E2ETests/Test452Base.cs @@ -10,6 +10,8 @@ using AI; using Microsoft.ApplicationInsights.DataContracts; using System.Collections.Generic; +using System.Globalization; +using System.Net; namespace E2ETests { @@ -86,7 +88,7 @@ public static void MyClassInitializeBase() DockerUtils.ExecuteDockerComposeCommand("up -d --build", DockerComposeFileName); Thread.Sleep(5000); DockerUtils.PrintDockerProcessStats("Docker-Compose -build retry"); - + PopulateIPAddresses(); allAppsHealthy = HealthCheckAndRemoveImageIfNeededAllApp(); } @@ -220,11 +222,14 @@ public void TestXComponentWebAppToWebApi() Apps[AppNameBeingTested].ikey, Apps[TestConstants.WebApiName].ikey).Wait(); } - public void TestSyncHttpDependency(string expectedPrefix, string appname, string path) + public void TestHttpDependency(string expectedPrefix, string appname, string path, + string resultCodeExpected = "200", + bool successExpected = true) { var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; - expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.Success = successExpected; + expectedDependencyTelemetry.ResultCode = resultCodeExpected; ValidateBasicDependency(Apps[appname].ipAddress, path, expectedDependencyTelemetry, Apps[appname].ikey, 1, expectedPrefix); @@ -232,7 +237,7 @@ public void TestSyncHttpDependency(string expectedPrefix, string appname, string public void TestSyncHttpDependency(string expectedPrefix) { - TestSyncHttpDependency(expectedPrefix, AppNameBeingTested, "/Dependencies.aspx?type=httpsync"); + TestHttpDependency(expectedPrefix, AppNameBeingTested, "/Dependencies.aspx?type=httpsync"); } public void TestAsyncWithHttpClientHttpDependency(string expectedPrefix) @@ -240,6 +245,7 @@ public void TestAsyncWithHttpClientHttpDependency(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasynchttpclient", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -249,7 +255,10 @@ public void TestPostCallHttpDependency(string expectedPrefix) { var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; - expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.Success = true; + + // 204 as the webapi does not return anything + expectedDependencyTelemetry.ResultCode = "204"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httppost", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -260,6 +269,7 @@ public void TestFailedHttpDependency(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpfailedwithexception", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -271,6 +281,9 @@ public void TestFailedAtDnsHttpDependency(string expectedPrefix) expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + // Failed at DNS means status code not collected + //expectedDependencyTelemetry.ResultCode = "200"; + ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpfailedwithinvaliddns", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); } @@ -280,6 +293,7 @@ public void TestAsyncHttpDependency1(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasync1", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -290,6 +304,7 @@ public void TestAsyncFailedHttpDependency1(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=failedhttpasync1", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -300,6 +315,7 @@ public void TestAsyncHttpDependency2(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasync2", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -310,6 +326,7 @@ public void TestAsyncFailedHttpDependency2(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=failedhttpasync2", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -320,6 +337,7 @@ public void TestAsyncHttpDependency3(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasync3", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -330,6 +348,7 @@ public void TestAsyncFailedHttpDependency3(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=failedhttpasync3", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -340,6 +359,7 @@ public void TestAsyncHttpDependency4(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasync4", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -350,6 +370,7 @@ public void TestAsyncFailedHttpDependency4(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=failedhttpasync4", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -360,6 +381,7 @@ public void TestAsyncAwaitCallHttpDependency(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.ResultCode = "200"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=httpasyncawait1", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -370,6 +392,7 @@ public void TestFailedAsyncAwaitCallHttpDependency(string expectedPrefix) var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "Http"; expectedDependencyTelemetry.Success = false; + expectedDependencyTelemetry.ResultCode = "500"; ValidateBasicDependency(Apps[AppNameBeingTested].ipAddress, "/Dependencies.aspx?type=failedhttpasyncawait1", expectedDependencyTelemetry, Apps[AppNameBeingTested].ikey, 1, expectedPrefix); @@ -382,7 +405,7 @@ public void TestAzureTableDependencyWebApp(string expectedPrefix) // Expected type is http instead of AzureTable as type is based on the target url which // will be a local url in case of emulator. expectedDependencyTelemetry.Type = "Http"; - expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.Success = true; // 2 dependency item is expected. // 1 from creating table, and 1 from writing data to it. @@ -397,7 +420,7 @@ public void TestAzureQueueDependencyWebApp(string expectedPrefix) // Expected type is http instead of AzureTable as type is based on the target url which // will be a local url in case of emulator. expectedDependencyTelemetry.Type = "Http"; - expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.Success = true; // 2 dependency item is expected. // 1 from creating queue, and 1 from writing data to it. @@ -412,7 +435,7 @@ public void TestAzureBlobDependencyWebApp(string expectedPrefix) // Expected type is http instead of AzureTable as type is based on the target url which // will be a local url in case of emulator. expectedDependencyTelemetry.Type = "Http"; - expectedDependencyTelemetry.Success = true; + expectedDependencyTelemetry.Success = true; // 2 dependency item is expected. // 1 from creating table, and 1 from writing data to it. @@ -428,6 +451,10 @@ public void TestSqlDependency(string expectedPrefix, string appname, string path var expectedDependencyTelemetry = new DependencyTelemetry(); expectedDependencyTelemetry.Type = "SQL"; expectedDependencyTelemetry.Success = success; + if (!success) + { + expectedDependencyTelemetry.ResultCode = "208"; + } ValidateBasicDependency(Apps[appname].ipAddress, path, expectedDependencyTelemetry, Apps[appname].ikey, 1, expectedPrefix); @@ -831,7 +858,8 @@ private async Task ValidateBasicRequestAsync(string targetInstanceIp, string tar } private void ValidateBasicDependency(string targetInstanceIp, string targetPath, - DependencyTelemetry expectedDependencyTelemetry, string ikey, int count, string expectedPrefix, int additionalSleepTimeMsec = 0) + DependencyTelemetry expectedDependencyTelemetry, string ikey, int count, + string expectedPrefix, int additionalSleepTimeMsec = 0) { var success = ExecuteWebRequestToTarget(targetInstanceIp, targetPath).Result; Assert.IsTrue(success, "Web App did not respond with success. Failing test. Check exception from logs."); @@ -986,6 +1014,24 @@ private void ValidateDependency(DependencyTelemetry expectedDependencyTelemetry, string actualSdkVersion = actualDependencyTelemetry.tags[new ContextTagKeys().InternalSdkVersion]; Assert.IsTrue(actualSdkVersion.Contains(expectedPrefix), "Actual version:" + actualSdkVersion); + + if(!string.IsNullOrEmpty(expectedDependencyTelemetry.ResultCode)) + { + Assert.AreEqual(expectedDependencyTelemetry.ResultCode, actualDependencyTelemetry.data.baseData.resultCode); + } + + var depTime = TimeSpan.Parse(actualDependencyTelemetry.data.baseData.duration, CultureInfo.InvariantCulture); + if (expectedDependencyTelemetry.Success.HasValue) + { + if(expectedDependencyTelemetry.Success.Value == true) + { + Assert.IsTrue(depTime.TotalMilliseconds > 0, "Access time should be above zero"); + } + else + { + Assert.IsTrue(depTime.TotalMilliseconds >= 0, "Access time should be zero or above zero if success is false."); + } + } } private void PrintDependencies(IList> dependencies) @@ -1014,7 +1060,7 @@ private void PrintRequests(IList> requests) { foreach (var req in requests) { - Trace.WriteLine("Dependency Item Details"); + Trace.WriteLine("Request Item Details"); Trace.WriteLine("req.time: " + req.time); Trace.WriteLine("req.iKey: " + req.iKey); Trace.WriteLine("req.name: " + req.name); diff --git a/Test/E2ETests/E2ETests/netcore20/TestCore20OnNetCore20.cs b/Test/E2ETests/E2ETests/netcore20/TestCore20OnNetCore20.cs index 42fc9358a..a28607f67 100644 --- a/Test/E2ETests/E2ETests/netcore20/TestCore20OnNetCore20.cs +++ b/Test/E2ETests/E2ETests/netcore20/TestCore20OnNetCore20.cs @@ -11,6 +11,7 @@ using Microsoft.ApplicationInsights.DataContracts; using System.Collections; using System.Collections.Generic; +using System.Net; namespace E2ETests.netcore20 { @@ -57,16 +58,23 @@ public static void MyClassInitialize(TestContext testContext) [TestMethod] [TestCategory("Core20")] - public void TestCore20OnNetCore20_SyncHttpDependency() + public void TestCore20OnNetCore20_HttpDependency() { - base.TestSyncHttpDependency(VersionPrefix, AppNameBeingTested, "/external/calls?type=http"); + base.TestHttpDependency(VersionPrefix, AppNameBeingTested, "/external/calls?type=http", "200", true); } [TestMethod] [TestCategory("Core20")] - public void TestCore20OnNetCore20_SyncHttpPostDependency() + public void TestCore20OnNetCore20_HttpPostDependency() { - base.TestSyncHttpDependency(VersionPrefix, AppNameBeingTested, "/external/calls?type=httppost"); + base.TestHttpDependency(VersionPrefix, AppNameBeingTested, "/external/calls?type=httppost", "204", true); + } + + [TestMethod] + [TestCategory("Core20")] + public void TestCore20OnNetCore20_FailedHttpDependency() + { + base.TestHttpDependency(VersionPrefix, AppNameBeingTested, "/external/calls?type=failedhttp", "500", false); } diff --git a/Test/E2ETests/TestApps/Net452/E2ETestApp/Dependencies.aspx.cs b/Test/E2ETests/TestApps/Net452/E2ETestApp/Dependencies.aspx.cs index 992e4feb3..ef3cb4604 100644 --- a/Test/E2ETests/TestApps/Net452/E2ETestApp/Dependencies.aspx.cs +++ b/Test/E2ETests/TestApps/Net452/E2ETestApp/Dependencies.aspx.cs @@ -30,7 +30,7 @@ public partial class Dependencies : System.Web.UI.Page private const string UrlTestWebApiGetCallTemplate = "http://{0}:80/api/values"; private const string UrlGoogle = "http://google.com"; - public const string UrlWhichThrowException = "http://e2etestwebapi:80/api/values/999"; + public const string UrlWhichThrowExceptionFormat = "http://{0}:80/api/values/999"; private const string UrlWithNonexistentHostName = "http://abcdefzzzzeeeeadadad.com"; private static bool etwEnabled = false; @@ -43,6 +43,7 @@ protected void Page_Load(object sender, EventArgs e) var webApiHostName = Microsoft.Azure.CloudConfigurationManager.GetSetting("webapihostname"); string UrlTestWebApiGetCall = string.Format(UrlTestWebApiGetCallTemplate, webApiHostName); + string UrlWhichThrowException = string.Format(UrlWhichThrowExceptionFormat, webApiHostName); var ingestionhostname = Microsoft.Azure.CloudConfigurationManager.GetSetting("ingestionhostname"); TelemetryConfiguration.Active.TelemetryChannel.EndpointAddress = string.Format(EndPointAddressFormat, ingestionhostname); diff --git a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/AppInsightsOptions.cs b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/AppInsightsOptions.cs index 4dc99b55a..9854fb4f5 100644 --- a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/AppInsightsOptions.cs +++ b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/AppInsightsOptions.cs @@ -7,5 +7,6 @@ public AppInsightsOptions() } public string EndPoint { get; set; } public string SqlServerInstance { get; set; } + public string Webapihostname { get; set; } } } \ No newline at end of file diff --git a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/Controllers/ExternalCallsController.cs b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/Controllers/ExternalCallsController.cs index e38b3c260..99c83598b 100644 --- a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/Controllers/ExternalCallsController.cs +++ b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/Controllers/ExternalCallsController.cs @@ -13,10 +13,13 @@ namespace E2ETestAppCore20.Controllers { [Route("external/calls")] public class ExternalCallsController : Controller - { /// - /// Invalid Hostname to trigger exception being thrown - /// - private const string InvalidHostName = "http://www.zzkaodkoakdahdjghejajdnad.com"; + { + + private const string UrlWithNonexistentHostName = "http://abcdefzzzzeeeeadadad.com"; + private const string UrlTestWebApiGetCallTemplate = "http://{0}:80/api/values"; + public const string UrlWhichThrowExceptionFormat = "http://{0}:80/api/values/999"; + public static string UrlTestWebApiGetCall; + public static string UrlWhichThrowException; /// /// Connection string format. @@ -59,6 +62,11 @@ public ExternalCallsController(IOptions options) { ConnectionString = string.Format(ConnectionStringFormat, options.Value.SqlServerInstance); } + + var webApiHostName = options.Value.Webapihostname; + UrlTestWebApiGetCall = string.Format(UrlTestWebApiGetCallTemplate, webApiHostName); + UrlWhichThrowException = string.Format(UrlWhichThrowExceptionFormat, webApiHostName); + } // GET external/calls @@ -115,48 +123,50 @@ public string Get() case "http": title = "Made Sync GET HTTP call to bing"; - MakeHttpGetCallSync(count, "bing"); + MakeHttpGetCallSync(count, UrlTestWebApiGetCall); response = title; break; case "httppost": title = "Made Sync POST HTTP call to bing"; - MakeHttpPostCallSync(count, "bing"); + MakeHttpPostCallSync(count, UrlTestWebApiGetCall); response = title; break; case "failedhttp": title = "Made failing Sync GET HTTP call to bing"; - MakeHttpCallSyncFailed(count); + MakeHttpCallSyncFailed(count, UrlWhichThrowException); response = title; break; case "ExecuteReaderAsync": SqlCommandHelper.ExecuteReaderAsync(ConnectionString, sqlQueryTouse); - response = QueryToExecuteLabel + sqlQueryTouse; + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "ExecuteScalarAsync": SqlCommandHelper.ExecuteScalarAsync(ConnectionString, sqlQueryTouse); - response = QueryToExecuteLabel + sqlQueryTouse; + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "ExecuteReaderStoredProcedureAsync": this.ExecuteReaderStoredProcedureAsync(); - response = QueryToExecuteLabel + sqlQueryTouse; + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "TestExecuteReaderTwiceWithTasks": SqlCommandHelper.AsyncExecuteReaderInTasks(ConnectionString, sqlQueryTouse); - response = QueryToExecuteLabel + sqlQueryTouse; + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "ExecuteNonQueryAsync": SqlCommandHelper.ExecuteNonQueryAsync(ConnectionString, sqlQueryTouse); - response = QueryToExecuteLabel + sqlQueryTouse; + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "ExecuteXmlReaderAsync": sqlQueryTouse += " FOR XML AUTO"; SqlCommandHelper.ExecuteXmlReaderAsync(ConnectionString, sqlQueryTouse); + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; case "SqlCommandExecuteScalar": sqlQueryTouse = success ? ValidSqlQueryCountToApmDatabase : InvalidSqlQueryToApmDatabase; SqlCommandHelper.ExecuteScalar(ConnectionString, sqlQueryTouse); + response = QueryToExecuteLabel + sqlQueryTouse + ConnectionString; break; default: title = $"Unrecognized request type '{type}'"; @@ -172,11 +182,11 @@ public string Get() /// /// no of GET calls to be made /// the GET call will be made to http://www.hostname.com - private static string MakeHttpGetCallSync(int count, string hostname) + private static string MakeHttpGetCallSync(int count, string target) { string result = ""; - Uri ourUri = new Uri(string.Format("https://www.{0}.com", hostname)); + Uri ourUri = new Uri(target); HttpClient client = new HttpClient(); for (int i = 0; i < count; i++) { @@ -191,17 +201,12 @@ private static string MakeHttpGetCallSync(int count, string hostname) /// /// no of POST calls to be made /// the POST call will be made to http://www.hostname.com - private static string MakeHttpPostCallSync(int count, string hostname) + private static string MakeHttpPostCallSync(int count, string target) { - string result = ""; - - Uri ourUri = new Uri(string.Format("https://www.{0}.com", hostname)); + string result = ""; HttpClient client = new HttpClient(); - HttpContent content = new StringContent("thing1=hello&thing2=world", Encoding.ASCII); - for (int i = 0; i < count; i++) - { - result += $"Request {i + 1}:
{client.PostAsync(ourUri, content).Result}
"; - } + var content = ("helloworld"); + result += client.PostAsync(target, new StringContent(content.ToString(), Encoding.UTF8, "application/json")).Result; return result; } @@ -210,11 +215,11 @@ private static string MakeHttpPostCallSync(int count, string hostname) /// Make sync http calls which fails /// /// no of calls to be made - private static string MakeHttpCallSyncFailed(int count) + private static string MakeHttpCallSyncFailed(int count, string target) { string result = ""; - Uri ourUri = new Uri(InvalidHostName); + Uri ourUri = new Uri(target); HttpClient client = new HttpClient(); for (int i = 0; i < count; ++i) { diff --git a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/appsettings.json b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/appsettings.json index ec51b7fc5..70dcb54c3 100644 --- a/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/appsettings.json +++ b/Test/E2ETests/TestApps/NetCore20/E2ETestAppCore20/appsettings.json @@ -13,5 +13,6 @@ } }, "EndPoint": "e2etests_ingestionservice_1", - "SqlServerInstance": "sql-server" + "SqlServerInstance": "sql-server", + "Webapihostname": "e2etestwebapi" } \ No newline at end of file diff --git a/buildRelease.cmd b/buildRelease.cmd index b23b6c758..270b5047e 100644 --- a/buildRelease.cmd +++ b/buildRelease.cmd @@ -9,5 +9,3 @@ SET Platform="Mixed Platforms" nuget restore -NonInteractive "%MSBUILD%" dirs.proj /nologo /m:1 /fl /toolsversion:%ToolsVersion% /flp:logfile=%ProjectName%.%Platform%.log;v=d /flp1:logfile=%ProjectName%.%Platform%.wrn;warningsonly /flp2:logfile=%ProjectName%.%Platform%.err;errorsonly /p:Configuration=%Configuration% /p:Platform=%Platform% /flp3:logfile=%ProjectName%.%Platform%.prf;performancesummary /flp4:logfile=%ProjectName%.%Platform%.exec.log;showcommandline /p:BuildSingleFilePackage=true - -PAUSE diff --git a/runFunctionalTests.cmd b/runFunctionalTests.cmd index fd2486913..a6e9eaab1 100644 --- a/runFunctionalTests.cmd +++ b/runFunctionalTests.cmd @@ -6,5 +6,14 @@ CALL buildRelease.cmd set BuildRoot=%~dp0..\bin\Release\ set VSTestPath=%PROGRAMFILES(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe -CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\E2ETests\E2ETests\E2ETests.dll" "%BuildRoot%Test\PerformanceCollector\FunctionalTests\PerfCollector.FunctionalTests.dll" "%BuildRoot%Test\Web\FunctionalTests\FunctionalTests\Functional.dll" /logger:trx +CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\PerformanceCollector\FunctionalTests\PerfCollector.FunctionalTests.dll" /logger:trx + +CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\Web\FunctionalTests\FunctionalTests\Functional.dll" /logger:trx + +CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\E2ETests\E2ETests\E2ETests.dll" /TestCaseFilter:"TestCategory=Core20" /logger:trx + +CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\E2ETests\E2ETests\E2ETests.dll" /TestCaseFilter:"TestCategory=Net452OnNet462" /logger:trx + +CALL "%VSTestPath%" /UseVsixExtensions:true "%BuildRoot%Test\E2ETests\E2ETests\E2ETests.dll" /TestCaseFilter:"TestCategory=Net452OnNet462SM" /logger:trx +