Exemple #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);
                }
            }
        }
    public RemoteWindowsDeployer(RemoteWindowsDeploymentParameters deploymentParameters, ILoggerFactory loggerFactory)
        : base(deploymentParameters, loggerFactory)
    {
        _deploymentParameters = deploymentParameters;

        if (_deploymentParameters.ServerType != ServerType.IIS &&
            _deploymentParameters.ServerType != ServerType.Kestrel &&
            _deploymentParameters.ServerType != ServerType.HttpSys)
        {
            throw new InvalidOperationException($"Server type {_deploymentParameters.ServerType} is not supported for remote deployment." +
                                                $" Supported server types are {nameof(ServerType.Kestrel)}, {nameof(ServerType.IIS)} and {nameof(ServerType.HttpSys)}");
        }

        if (string.IsNullOrEmpty(_deploymentParameters.ServerName))
        {
            throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerName}' for {nameof(RemoteWindowsDeploymentParameters.ServerName)}");
        }

        if (string.IsNullOrEmpty(_deploymentParameters.ServerAccountName))
        {
            throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerAccountName}' for {nameof(RemoteWindowsDeploymentParameters.ServerAccountName)}." +
                                        " Account credentials are required to enable creating a powershell session to the remote server.");
        }

        if (string.IsNullOrEmpty(_deploymentParameters.ServerAccountPassword))
        {
            throw new ArgumentException($"Invalid value '{_deploymentParameters.ServerAccountPassword}' for {nameof(RemoteWindowsDeploymentParameters.ServerAccountPassword)}." +
                                        " Account credentials are required to enable creating a powershell session to the remote server.");
        }

        if (_deploymentParameters.ApplicationType == ApplicationType.Portable &&
            string.IsNullOrEmpty(_deploymentParameters.DotnetRuntimePath))
        {
            throw new ArgumentException($"Invalid value '{_deploymentParameters.DotnetRuntimePath}' for {nameof(RemoteWindowsDeploymentParameters.DotnetRuntimePath)}. " +
                                        "It must be non-empty for portable apps.");
        }

        if (string.IsNullOrEmpty(_deploymentParameters.RemoteServerFileSharePath))
        {
            throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.RemoteServerFileSharePath)}." +
                                        " . A file share is required to copy the application's published output.");
        }

        if (string.IsNullOrEmpty(_deploymentParameters.ApplicationBaseUriHint))
        {
            throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.ApplicationBaseUriHint)}.");
        }
    }
Exemple #3
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);
                }
            }
        }
        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);
                }
            }
        }