public ECSFargateDeploymentTest() { var filePath = Path.Combine("ConfigFileDeployment", "TestFiles", "UnitTestFiles", "ECSFargateConfigFile.json"); var userDeploymentSettings = UserDeploymentSettings.ReadSettings(filePath); _userDeploymentSettings = userDeploymentSettings; }
public ElasticBeanStalkDeploymentTest() { var filePath = Path.Combine("ConfigFileDeployment", "TestFiles", "UnitTestFiles", "ElasticBeanStalkConfigFile.json"); var userDeploymentSettings = UserDeploymentSettings.ReadSettings(filePath); _userDeploymentSettings = userDeploymentSettings; }
public async Task PerformDeployment() { // Deploy var projectPath = _testAppManager.GetProjectPath(Path.Combine("testapps", "WebAppWithDockerFile", "WebAppWithDockerFile.csproj")); var configFilePath = Path.Combine(Directory.GetParent(projectPath).FullName, "ECSFargateConfigFile.json"); ConfigFileHelper.ReplacePlaceholders(configFilePath); var userDeploymentSettings = UserDeploymentSettings.ReadSettings(configFilePath); _stackName = userDeploymentSettings.StackName; _clusterName = userDeploymentSettings.LeafOptionSettingItems["ECSCluster.NewClusterName"]; var deployArgs = new[] { "deploy", "--project-path", projectPath, "--apply", configFilePath, "--silent" }; await _app.Run(deployArgs); // Verify application is deployed and running Assert.Equal(StackStatus.CREATE_COMPLETE, await _cloudFormationHelper.GetStackStatus(_stackName)); var cluster = await _ecsHelper.GetCluster(_clusterName); Assert.Equal("ACTIVE", cluster.Status); Assert.Equal(cluster.ClusterName, _clusterName); var deployStdOut = _interactiveService.StdOutReader.ReadAllLines(); var applicationUrl = deployStdOut.First(line => line.Trim().StartsWith("Endpoint:")) .Split(" ")[1] .Trim(); // URL could take few more minutes to come live, therefore, we want to wait and keep trying for a specified timeout await _httpHelper.WaitUntilSuccessStatusCode(applicationUrl, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(5)); // list var listArgs = new[] { "list-deployments" }; await _app.Run(listArgs); // Verify stack exists in list of deployments var listDeployStdOut = _interactiveService.StdOutReader.ReadAllLines(); Assert.Contains(listDeployStdOut, (deployment) => _stackName.Equals(deployment)); // Arrange input for delete await _interactiveService.StdInWriter.WriteAsync("y"); // Confirm delete await _interactiveService.StdInWriter.FlushAsync(); var deleteArgs = new[] { "delete-deployment", _stackName }; // Delete await _app.Run(deleteArgs); // Verify application is deleted Assert.True(await _cloudFormationHelper.IsStackDeleted(_stackName), $"{_stackName} still exists."); }