From e4a0306f6868e79c2a001912959c96e8dab21cbc Mon Sep 17 00:00:00 2001 From: Brent Langston Date: Tue, 14 Aug 2018 13:52:31 -0500 Subject: [PATCH] testing scripts --- test/cycle.sh | 4 ++++ test/down.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ test/endless.sh | 12 ++++++++++ test/up.sh | 26 +++++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 test/cycle.sh create mode 100644 test/down.sh create mode 100644 test/endless.sh create mode 100644 test/up.sh diff --git a/test/cycle.sh b/test/cycle.sh new file mode 100644 index 0000000..02e7751 --- /dev/null +++ b/test/cycle.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +./up.sh +./down.sh diff --git a/test/down.sh b/test/down.sh new file mode 100644 index 0000000..d6c3273 --- /dev/null +++ b/test/down.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +set -e + +cd ~/environment/ecsdemo-crystal +mu pipeline term + +cd ~/environment/ecsdemo-nodejs +mu pipeline term + +echo "================================" +echo "Beginning frontend pipeline term at $(date)" +cd ~/environment/ecsdemo-frontend +mu pipeline term + +echo "================================" +echo "Beginning acceptance platform term at $(date)" +cd ~/environment/ecsdemo-platform +mu env term acceptance +echo "================================" +echo "Beginning production platform term at $(date)" +mu env term production + +echo "================================" +echo "Beginning ecr repo delete at $(date)" +aws ecr delete-repository --repository-nam ${MU_NAMESPACE}-ecsdemo-frontend --force +aws ecr delete-repository --repository-nam ${MU_NAMESPACE}-ecsdemo-nodejs --force +aws ecr delete-repository --repository-nam ${MU_NAMESPACE}-ecsdemo-crystal --force + +echo "================================" +echo "Beginning s3 bucket delete at $(date)" +export REGION=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/\(.*\)[a-z]/\1/' +) +export ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) +aws s3 rm --recursive s3://${MU_NAMESPACE}-codedeploy-${REGION}-${ACCOUNT_ID} +aws s3 rm --recursive s3://${MU_NAMESPACE}-codepipeline-${REGION}-${ACCOUNT_ID} + +echo "================================" +echo "Beginning cf stack delete at $(date)" +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-frontend-acceptance +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-frontend-production +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-nodejs-acceptance +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-nodejs-production +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-crystal-acceptance +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-service-ecsdemo-crystal-production + +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-repo-ecsdemo-frontend +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-repo-ecsdemo-nodejs +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-repo-ecsdemo-crystal + +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-bucket-codedeploy +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-bucket-codepipeline + +echo "================================" +echo "Beginning sleep 300 at $(date)" +sleep 300 # delay waiting for all the other CF stacks to be deleted -- replace with a count of stacks or something + +echo "================================" +echo "Beginning iam-common stack delete at $(date)" +aws cloudformation delete-stack --stack-name ${MU_NAMESPACE}-iam-common +echo "================================" +echo "Teardown complete at $(date)" diff --git a/test/endless.sh b/test/endless.sh new file mode 100644 index 0000000..ceddace --- /dev/null +++ b/test/endless.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +count=1 + +while true; do + echo "================================" + echo "Beginning test ${count} build at $(date)" + ./cycle.sh + echo "Ending test ${count} build at $(date)" + echo "================================" + ((count++)) +done diff --git a/test/up.sh b/test/up.sh new file mode 100644 index 0000000..f8ace6c --- /dev/null +++ b/test/up.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +echo "================================" +echo "Beginning acceptance platform build at $(date)" +cd ~/environment/ecsdemo-platform +mu env up acceptance +echo "================================" +echo "Beginning production platform build at $(date)" +mu env up production + +echo "================================" +echo "Beginning frontend pipeline build at $(date)" +cd ~/environment/ecsdemo-frontend +mu pipeline up -t $GITHUB_TOKEN + +echo "================================" +echo "Beginning nodejs pipeline build at $(date)" +cd ~/environment/ecsdemo-nodejs +mu pipeline up -t $GITHUB_TOKEN + +echo "================================" +echo "Beginning crystal pipeline build at $(date)" +cd ~/environment/ecsdemo-crystal +mu pipeline up -t $GITHUB_TOKEN