spinnaker-plugins/aws-account-registration-plugin-spinnaker

Test Multiple Suspensions for Same Spinnaker Accounts - EC2, ECS, Lambda

Closed this issue · 1 comments

Name of Tester: Jason Coffman (@jasoncoffman)
Date of Test: 25 August 2020
Title of Test: Test Multiple Suspensions for Same Spinnaker Accounts - EC2, ECS, Lambda

Spinnaker Version: 1.21.4
Plugin Version: 0.0.1

Status: PASS

Step 1

Create Spinnaker Account for EC2, ECS, and Lambda by creating a response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "ACTIVE",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 2

Execute curl http://localhost:7002/credentials to verify account creation

Expected:

Two accounts are created - one with type: aws and another with type: ecs

Output:
[
  {
    "accountId": "111122223333",
    "accountType": "isengard-2",
    "challengeDestructiveActions": false,
    "cloudProvider": "aws",
    "environment": "isengard-2",
    "name": "isengard-2",
    "permissions": {},
    "primaryAccount": false,
    "providerVersion": "v1",
    "requiredGroupMembership": [],
    "type": "aws"
  },
  {
    "accountId": "111122223333",
    "accountType": "ecs",
    "challengeDestructiveActions": false,
    "cloudProvider": "ecs",
    "environment": "isengard-2",
    "name": "isengard-2-ecs",
    "permissions": {},
    "primaryAccount": false,
    "providerVersion": "v1",
    "requiredGroupMembership": [],
    "type": "ecs"
  }
]

Step 3

Suspend Spinnaker Account for EC2, ECS, and Lambda by editing the response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "SUSPENDED",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 4

Execute curl http://localhost:7002/credentials to verify account suspension

Expected

There will be no accounts listed

Output
[
]

Step 5

Update the Spinnaker accounts with the same suspended accounts by editing the response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "SUSPENDED",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 6

Execute curl http://localhost:7002/credentials to verify account suspension

Expected

There will neither accounts listed nor errors thrown

Output
[
]

Name of Tester: Jason Coffman (@jasoncoffman)
Date of Test: 26 August 2020
Title of Test: Test Multiple Suspensions for Same Spinnaker Accounts - EC2, ECS, Lambda

Spinnaker Version: 1.21.4
Plugin Version: 0.0.1

Status: PASS

Step 1

Create Spinnaker Account for EC2, ECS, and Lambda by creating a response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "ACTIVE",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 2

Execute curl http://localhost:7002/credentials to verify account creation

Expected:

Two accounts are created - one with type: aws and another with type: ecs

Output:
[
  {
    "accountId": "111122223333",
    "accountType": "isengard-2",
    "challengeDestructiveActions": false,
    "cloudProvider": "aws",
    "environment": "isengard-2",
    "name": "isengard-2",
    "permissions": {},
    "primaryAccount": false,
    "providerVersion": "v1",
    "requiredGroupMembership": [],
    "type": "aws"
  },
  {
    "accountId": "111122223333",
    "accountType": "ecs",
    "challengeDestructiveActions": false,
    "cloudProvider": "ecs",
    "environment": "isengard-2",
    "name": "isengard-2-ecs",
    "permissions": {},
    "primaryAccount": false,
    "providerVersion": "v1",
    "requiredGroupMembership": [],
    "type": "ecs"
  }
]

Step 3

Suspend Spinnaker Account for EC2, ECS, and Lambda by editing the response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "SUSPENDED",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 4

Execute curl http://localhost:7002/credentials to verify account suspension

Expected

There will be no accounts listed

Output
[
]

Step 5

Update the Spinnaker accounts with the same suspended accounts by editing the response.json file with the below content to be served via the Golang test server

{
  "SpinnakerAccounts": [
    {
      "AccountId": "111122223333",
      "SpinnakerAccountName": "isengard-2",
      "Regions": [
        "us-west-2"
      ],
      "SpinnakerStatus": "SUSPENDED",
      "SpinnakerAssumeRole": "role/spinnakerManaged",
      "SpinnakerProviders": [
        "ec2", "ecs", "lambda"
      ],
      "SpinnakerId": "spinnaker1",
      "CreatedAt": "1598026448909989587",
      "UpdatedAt": "1598027546352397694"
    }
  ],
  "Pagination": {
    "NextUrl": ""
  }
}

Step 6

Execute curl http://localhost:7002/credentials to verify account suspension

Expected

There will neither accounts listed nor errors thrown

Output
[
]