Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe("waitForDeploymentOutcome", () => {
const deploymentB = {
id: "2",
status: DeploymentStatus.PRIMARY,
taskDefinitionArn: TASK_DEFINITION_ARN.slice(0, -1),
taskDefinitionArn: TASK_DEFINITION_ARN + "1",
rolloutState: RolloutState.IN_PROGRESS
};
const finalDeploymentsState = [{ ...deploymentA }, { ...deploymentB }];
Expand All @@ -136,6 +136,37 @@ describe("waitForDeploymentOutcome", () => {
).toBe(DeploymentOutcome.SKIPPED);
});

test("It must return 'rollback' if a rollback enqueued", async () => {
const deploymentA = {
id: "1",
status: DeploymentStatus.PRIMARY,
taskDefinitionArn: TASK_DEFINITION_ARN,
rolloutState: RolloutState.IN_PROGRESS
};
const initialDeploymentsState = [{ ...deploymentA }];
mockedFetchDeployments = mockedFetchDeployments.mockReturnValueOnce(initialDeploymentsState);

deploymentA.status = DeploymentStatus.ACTIVE;
const deploymentB = {
id: "2",
status: DeploymentStatus.PRIMARY,
taskDefinitionArn: TASK_DEFINITION_ARN.slice(0, -1),
rolloutState: RolloutState.IN_PROGRESS
};
const finalDeploymentsState = [{ ...deploymentA }, { ...deploymentB }];
mockedFetchDeployments = mockedFetchDeployments.mockReturnValueOnce(finalDeploymentsState);

expect(
await waitForDeploymentOutcome(
CLUSTER,
SERVICE,
TASK_DEFINITION_ARN,
setTimeout(() => {}),
1
)
).toBe(DeploymentOutcome.ROLLBACK);
});

test("It must timeout service deployment never becomes stable", async () => {
const deployments = [
{
Expand Down
Loading