Example #1
0
        public async Task RunTestsAsync(
            ServerType serverType,
            string applicationBaseUrl,
            ApplicationType applicationType)
        {
            using (_logger.BeginScope(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime)))
            {
                var deploymentParameters = new RemoteWindowsDeploymentParameters(
                    Helpers.GetApplicationPath(applicationType),
                    _remoteDeploymentConfig.DotnetRuntimePathOnShare,
                    serverType,
                    RuntimeFlavor.CoreClr,
                    RuntimeArchitecture.x64,
                    _remoteDeploymentConfig.FileSharePath,
                    _remoteDeploymentConfig.ServerName,
                    _remoteDeploymentConfig.AccountName,
                    _remoteDeploymentConfig.AccountPassword)
                {
                    TargetFramework        = "netcoreapp1.0",
                    ApplicationBaseUriHint = applicationBaseUrl,
                    ApplicationType        = applicationType
                };
                deploymentParameters.EnvironmentVariables.Add(
                    new KeyValuePair <string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting"));

                using (var deployer = new RemoteWindowsDeployer(deploymentParameters, _logger))
                {
                    var deploymentResult = deployer.Deploy();

                    await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger);
                }
            }
        }
Example #2
0
        public async Task SmokeTestSuite(
            ServerType serverType,
            RuntimeFlavor runtimeFlavor,
            RuntimeArchitecture architecture,
            ApplicationType applicationType,
            string applicationBaseUrl,
            bool noSource = false)
        {
            using (_logger.BeginScope("SmokeTestSuite"))
            {
                var musicStoreDbName = DbUtils.GetUniqueName();

                var deploymentParameters = new DeploymentParameters(
                    Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
                {
                    ApplicationBaseUriHint      = applicationBaseUrl,
                    EnvironmentName             = "SocialTesting",
                    ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
                    SiteName = "MusicStoreTestSite",
                    PublishApplicationBeforeDeployment       = true,
                    PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
                    TargetFramework       = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
                    Configuration         = Helpers.GetCurrentBuildConfiguration(),
                    ApplicationType       = applicationType,
                    UserAdditionalCleanup = parameters =>
                    {
                        DbUtils.DropDatabase(musicStoreDbName, _logger);
                    }
                };

                if (applicationType == ApplicationType.Standalone)
                {
                    deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
                }

                // 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, _logger))
                {
                    var deploymentResult = deployer.Deploy();

                    Helpers.SetInMemoryStoreForIIS(deploymentParameters, _logger);

                    await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger);
                }
            }
        }
Example #3
0
        public async Task SmokeTestSuite(
            ServerType serverType,
            RuntimeArchitecture architecture,
            ApplicationType applicationType,
            bool noSource = false)
        {
            var testName = $"SmokeTestSuite_{serverType}_{architecture}_{applicationType}";

            using (StartLog(out var loggerFactory, testName))
            {
                var logger           = loggerFactory.CreateLogger("SmokeTestSuite");
                var musicStoreDbName = DbUtils.GetUniqueName();

                var deploymentParameters = new DeploymentParameters(
                    Helpers.GetApplicationPath(applicationType), serverType, RuntimeFlavor.CoreClr, architecture)
                {
                    EnvironmentName             = "SocialTesting",
                    ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
                    SiteName = "MusicStoreTestSite",
                    PublishApplicationBeforeDeployment       = true,
                    PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
                    TargetFramework       = "netcoreapp2.0",
                    Configuration         = Helpers.GetCurrentBuildConfiguration(),
                    ApplicationType       = applicationType,
                    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();

                    Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger);

                    await SmokeTestHelper.RunTestsAsync(deploymentResult, logger);
                }
            }
        }
Example #4
0
        public async Task RunTestsAsync(
            ServerType serverType,
            string applicationBaseUrl,
            ApplicationType applicationType)
        {
            using (_logger.BeginScope(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime)))
            {
                var deploymentParameters = new RemoteWindowsDeploymentParameters(
                    Helpers.GetApplicationPath(applicationType),
                    _remoteDeploymentConfig.DotnetRuntimePathOnShare,
                    serverType,
                    RuntimeFlavor.CoreClr,
                    RuntimeArchitecture.x64,
                    _remoteDeploymentConfig.FileSharePath,
                    _remoteDeploymentConfig.ServerName,
                    _remoteDeploymentConfig.AccountName,
                    _remoteDeploymentConfig.AccountPassword)
                {
                    TargetFramework        = "netcoreapp1.1",
                    ApplicationBaseUriHint = applicationBaseUrl,
                    ApplicationType        = applicationType
                };

                if (applicationType == ApplicationType.Standalone)
                {
                    // Unable to use the RuntimeEnvironment.GetRuntimeIdentifier API here as NanoServer which is
                    // part of Windows Server 2016 has a RID of 'win10-x64' where as the CI servers currently
                    // run on Windows Server 2012 or less, which have different RIDs.
                    deploymentParameters.AdditionalPublishParameters = "-r win10-x64";
                }

                deploymentParameters.EnvironmentVariables.Add(
                    new KeyValuePair <string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting"));

                using (var deployer = new RemoteWindowsDeployer(deploymentParameters, _logger))
                {
                    var deploymentResult = deployer.Deploy();

                    await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger);
                }
            }
        }