public async Task DefaultLocation_Kestrel() { var serverType = ServerType.Kestrel; var testName = $"SmokeTestsUsingStore_{serverType}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger(nameof(StoreSmokeTests)); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) { EnvironmentName = "SocialTesting", SiteName = "MusicStoreTestSiteUsingStore", PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = Tfm.NetCoreApp20, // There's only a Store on 2.0 ApplicationType = ApplicationType.Portable, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); logger.LogInformation("Published output directory structure:"); logger.LogInformation(GetDirectoryStructure(deploymentResult.ContentRoot)); var mvcCoreDll = "Microsoft.AspNetCore.Mvc.Core.dll"; logger.LogInformation( $"Checking if published output was trimmed by verifying that the dll '{mvcCoreDll}' is not present..."); var mvcCoreDllPath = Path.Combine(deploymentResult.ContentRoot, mvcCoreDll); var fileInfo = new FileInfo(mvcCoreDllPath); Assert.False( File.Exists(mvcCoreDllPath), $"The file '{fileInfo.Name}.{fileInfo.Extension}' was not expected to be present in the publish directory"); logger.LogInformation($"Published output does not have the dll '{mvcCoreDll}', so the output seems to be trimmed"); await SmokeTests.RunTestsAsync(deploymentResult, logger); } } }
public async Task RunTestsAsync( ServerType serverType, string applicationBaseUrl, ApplicationType applicationType) { var testName = $"SmokeTestsOnNanoServer_{serverType}_{applicationType}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime)); var deploymentParameters = new RemoteWindowsDeploymentParameters( Helpers.GetApplicationPath(), _remoteDeploymentConfig.DotnetRuntimePathOnShare, serverType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, _remoteDeploymentConfig.FileSharePath, _remoteDeploymentConfig.ServerName, _remoteDeploymentConfig.AccountName, _remoteDeploymentConfig.AccountPassword) { TargetFramework = Tfm.Default, ApplicationBaseUriHint = applicationBaseUrl, ApplicationType = applicationType }; deploymentParameters.EnvironmentVariables.Add( new KeyValuePair <string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting")); using (var deployer = new RemoteWindowsDeployer(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); await SmokeTests.RunTestsAsync(deploymentResult, logger); } } }