|
| 1 | +# Integration tests |
| 2 | + |
| 3 | +The following integration workflow is how you can |
| 4 | +test your changes and verifying that new dependencies didn’t break the updater mechanisms. |
| 5 | +It’s also similar to how we verify versions of the ECS Updater, |
| 6 | +so it’s useful to go through it when making changes |
| 7 | +and should in total take less than 1 hour. |
| 8 | + |
| 9 | +1. You’ll want to set up a test ECS cluster. |
| 10 | + |
| 11 | + Thankfully, this is really easy with the existing integration tests setup script: |
| 12 | + https://github.com/bottlerocket-os/bottlerocket-ecs-updater/blob/develop/integ/setup.sh |
| 13 | + |
| 14 | + ```sh |
| 15 | + ./setup.sh --ami-id ami-05d2e4a6b8399095a |
| 16 | + ``` |
| 17 | + |
| 18 | + This script expects the ami-id of a Bottlerocket ECS variant. |
| 19 | + This will setup an ECS cluster using the integration CloudFormation stack |
| 20 | + and using that Bottlerocket ECS variant as EC2 compute. |
| 21 | + |
| 22 | +2. Build an ECS updater image from your changes: |
| 23 | + |
| 24 | + ``` |
| 25 | + # Build the image and tag it as "latest" |
| 26 | + make image |
| 27 | +
|
| 28 | + # Verify the image was built and tagged a moment ago |
| 29 | + docker images | head -n 10 |
| 30 | +
|
| 31 | + # Re-tag the image to wherever you want to land it on your ECR registry |
| 32 | + docker tag bottlerocket-ecs-updater:latest \ |
| 33 | + <account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test |
| 34 | +
|
| 35 | + # Push it to your ECR registry |
| 36 | + docker push \ |
| 37 | + <account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test |
| 38 | + ``` |
| 39 | + |
| 40 | +3. Once your integration ECS cluster is up and you’ve built/pushed a new image, |
| 41 | +you can execute the run-updater script to actually do the integration tests! |
| 42 | + |
| 43 | + Note that you need to provide the image URL of the new image you just built. |
| 44 | + This is the actual image that gets deployed as a fargate task! |
| 45 | + |
| 46 | + ``` |
| 47 | + ./run-updater.sh \ |
| 48 | + --cluster ecs-updater-integ-cluster \ |
| 49 | + --updater-image <account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test |
| 50 | + ``` |
| 51 | + |
| 52 | +4. Cleanup is also easy! There’s a script for that as well: |
| 53 | + |
| 54 | + ``` |
| 55 | + ./cleanup.sh --cluster ecs-updater-integ-cluster |
| 56 | + ``` |
| 57 | + |
| 58 | + This tears down the ECS cluster by name releasing any artifacts from the integration tests. |
| 59 | + |
| 60 | +In all, the total process takes well under an hour. ECS clusters spin up and down very quickly. |
0 commit comments