From f191bec4f81fbff659b684d3fac96b3b1b3d7d62 Mon Sep 17 00:00:00 2001 From: Michael Tarng <20913254+mtarng@users.noreply.github.com> Date: Mon, 13 Apr 2020 16:39:26 -0700 Subject: [PATCH] Ring smoke tests - delete ring --- tests/README.md | 25 +++++++++++++----- tests/validations.sh | 62 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/tests/README.md b/tests/README.md index cff5ca99..80574b61 100644 --- a/tests/README.md +++ b/tests/README.md @@ -34,14 +34,15 @@ for this. Edit the values in `parameters` and fill in your `` and `resource group` where the storage account is. To check existing Logic Apps in your subscription, go to the -[portal.azure.com](http://portal.azure.com) and search for Logic Apps. +[Azure Portal](http://portal.azure.com) and search for Logic Apps. # Scenarios Exercised So Far -- As a developer create a mono-repo and add services -- As a developer create variable group with variables -- As a developer create a pipeline from an existing service -- As a developer create a service revision from an existing service +- As a developer create a mono-repo and add services. +- As a developer, create a new ring for a mono-repo. +- As a developer create variable group with variables. +- As a developer create a pipeline from an existing service. +- As a developer create a service revision from an existing service. - As a developer create an HLD of a terraform template for infra deployment. # Operational Coverage @@ -56,8 +57,8 @@ To check existing Logic Apps in your subscription, go to the | Command | Coverage | | -------------------------------------- | -------- | -| spk project init | ✅ | | spk project create-variable-group | ✅ | +| spk project init | ✅ | | spk project install-lifecycle-pipeline | ✅ | ## Service Management @@ -65,15 +66,25 @@ To check existing Logic Apps in your subscription, go to the | Command | Coverage | | ---------------------------------- | -------- | | spk service create | ✅ | -| spk service install-build-pipeline | ✅ | | spk service create-revision | ✅ | +| spk service install-build-pipeline | ✅ | + +## Ring Management + +| Command | Coverage | +| -------------------- | -------- | +| spk ring create | ✅ | +| spk ring delete | ✅ | +| spk ring set-default | 🚫 | ## HLD Management | Command | Coverage | | --------------------------------- | -------- | +| spk hld append-variable-group | ✅ | | spk hld init | ✅ | | spk hld install-manifest-pipeline | ✅ | +| spk hld reconcile | ✅ | ## Variable Group Management diff --git a/tests/validations.sh b/tests/validations.sh index c760d26b..0ba28db3 100644 --- a/tests/validations.sh +++ b/tests/validations.sh @@ -269,7 +269,7 @@ lifecycle_pipeline_name="$mono_repo_dir-lifecycle" pipeline_exists $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name # Deploy lifecycle pipeline and verify it runs. -spk project install-lifecycle-pipeline --org-name $AZDO_ORG --devops-project $AZDO_PROJECT --repo-url "https://$repo_url" --pipeline-name $lifecycle_pipeline_name --personal-access-token $ACCESS_TOKEN_SECRET >> $TEST_WORKSPACE/log.txt +spk project install-lifecycle-pipeline --org-name $AZDO_ORG --devops-project $AZDO_PROJECT --repo-url "https://$repo_url" --pipeline-name $lifecycle_pipeline_name --personal-access-token $ACCESS_TOKEN_SECRET >> $TEST_WORKSPACE/log.txt # TODO: Verify the lifecycle pipeline sucessfully runs # Verify lifecycle pipeline was created @@ -388,7 +388,7 @@ git checkout master git pull origin master spk ring create $ring_name git add -A -git commit -m "Adding test ring" +git commit -m "Adding test ring: $ring_name" git push -u origin --all # Wait for the lifecycle pipeline to finish and approve the pull request @@ -403,7 +403,7 @@ git pull hld_repo_commit_id=$(git log --format="%H" -n 1) verify_pipeline_with_poll_and_source_version $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 300 15 $hld_repo_commit_id -# Verify the file was added in the manifest repository +# Verify the ring directory with static components was added in the manifest repository cd $TEST_WORKSPACE cd $manifests_dir @@ -419,7 +419,7 @@ echo "Validating ingress routes" validate_file "$ring_dir/static.yaml" "'PathPrefix(\`/fabrikam-acme-frontend\`) && Headers(\`Ring\`, \`qa-ring\`)'" -echo "Successfully created a ring." +echo "Successfully created ring: $ring_name." ################################## # App Mono Repo update ring @@ -464,6 +464,56 @@ validate_file "$TEST_WORKSPACE/$manifests_dir/prod/$mono_repo_dir/$FrontEndCompl echo "Successfully updated a ring." # -------------------------------- +################################## +# App Mono Repo delete ring +################################## +echo "Deleting ring in mono repo" + +# Wait for fabrikam-hld-to-fabrikam-manifests pipeline to finish +echo "Wait for fabrikam-hld-to-fabrikam-manifests pipeline" +cd $TEST_WORKSPACE/$hld_dir +git pull +hld_repo_commit_id=$(git log --format="%H" -n 1) +verify_pipeline_with_poll_and_source_version $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 500 15 $hld_repo_commit_id + +cd $TEST_WORKSPACE +cd $mono_repo_dir + +echo "Delete ring" +git checkout master +git pull origin master +spk ring delete $ring_name +git add -A +git commit -m "Deleting test ring: $ring_name" +git push -u origin --all + +# Wait for the lifecycle pipeline to finish and approve the pull request +mono_repo_commit_id=$(git log --format="%H" -n 1) +verify_pipeline_with_poll_and_source_version $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name 300 15 $mono_repo_commit_id +echo "Finding pull request that $lifecycle_pipeline_name pipeline created..." +approve_pull_request $AZDO_ORG_URL $AZDO_PROJECT "Reconciling HLD" + +# Wait for fabrikam-hld-to-fabrikam-manifests pipeline to finish +cd $TEST_WORKSPACE/$hld_dir +git pull +hld_repo_commit_id=$(git log --format="%H" -n 1) +verify_pipeline_with_poll_and_source_version $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 300 15 $hld_repo_commit_id + +# Verify the ring directory was removed in the manifest repository +cd $TEST_WORKSPACE +cd $manifests_dir + +git pull origin master + +ring_dir="prod/$mono_repo_dir/fabrikam-acme-frontend/$ring_name" +if [ -d "$ring_dir" ]; then + echo "Directory '$ring_dir' exists, but it should not exist." + exit 1 +fi + +echo "Successfully deleted ring: $ring_name." + + echo "Successfully reached the end of the service validations scripts." ################################## @@ -508,4 +558,8 @@ else exit 1 fi +################################## +# All Tests Completed. +################################## + echo "Successfully reached the end of spk deployment get tests."