Skip to content

Commit

Permalink
Merge pull request #317 from aws/kmalhar/fix-ecs-redeployment
Browse files Browse the repository at this point in the history
  • Loading branch information
96malhar authored Sep 1, 2021
2 parents 5b9252f + 4f98636 commit d438a63
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/AWS.Deploy.Recipes.CDK.Common/CDKRecipeSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.Configuration;

using Amazon.CDK;
using System.Text.Json.Serialization;

namespace AWS.Deploy.Recipes.CDK.Common
{
Expand All @@ -27,7 +28,13 @@ public static void RegisterStack<C>(Stack stack, IRecipeProps<C> recipeConfigura
stack.Tags.SetTag(Constants.CloudFormationIdentifier.STACK_TAG, $"{recipeConfiguration.RecipeId}");

// Serializes all AWS .NET deployment tool settings.
var json = JsonSerializer.Serialize(recipeConfiguration.Settings, new JsonSerializerOptions { WriteIndented = false });
var json = JsonSerializer.Serialize(
recipeConfiguration.Settings,
new JsonSerializerOptions
{
WriteIndented = false,
Converters = { new JsonStringEnumConverter() }
});

Dictionary<string, object> metadata;
if(stack.TemplateOptions.Metadata?.Count > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AutoScalingConfiguration

public enum ScalingTypeEnum { Cpu, Memory, Request }

public ScalingTypeEnum ScalingType { get; set; } = ScalingTypeEnum.Cpu;
public ScalingTypeEnum? ScalingType { get; set; }



Expand Down
11 changes: 11 additions & 0 deletions test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ public async Task DefaultConfigurations()
var listDeployStdOut = _interactiveService.StdOutReader.ReadAllLines();
Assert.Contains(listDeployStdOut, (deployment) => _stackName.Equals(deployment));

// Arrange input for re-deployment
await _interactiveService.StdInWriter.WriteAsync(Environment.NewLine); // Select default option settings
await _interactiveService.StdInWriter.FlushAsync();

// Perform re-deployment
deployArgs = new[] { "deploy", "--project-path", projectPath, "--stack-name", _stackName, "--diagnostics" };
var returnCode = await _app.Run(deployArgs);
Assert.Equal(CommandReturnCodes.SUCCESS, returnCode);
Assert.Equal(StackStatus.UPDATE_COMPLETE, await _cloudFormationHelper.GetStackStatus(_stackName));
Assert.Equal("ACTIVE", cluster.Status);

// Arrange input for delete
await _interactiveService.StdInWriter.WriteAsync("y"); // Confirm delete
await _interactiveService.StdInWriter.FlushAsync();
Expand Down

0 comments on commit d438a63

Please sign in to comment.