Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.
Merged
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
5 changes: 3 additions & 2 deletions tests/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ function verify_pipeline_with_poll () {
local pipeline_name=$3
poll_timeout=$4
poll_interval=$5
expected_build_count=$6
end=$((SECONDS+$poll_timeout))
loop_result="unknown"

Expand All @@ -304,8 +305,8 @@ function verify_pipeline_with_poll () {

# We expect only 1 build right now
build_count=$(tr '"\""' '"\\"' <<< "$pipeline_builds" | jq '. | length')
if [ "$build_count" != "1" ]; then
echo "Expected 1 build for pipeline: $pipeline_name-$pipeline_id but found $build_count"
if [ "$build_count" != "$expected_build_count" ]; then
echo "Expected $expected_build_count build for pipeline: $pipeline_name-$pipeline_id but found $build_count"
exit 1
fi

Expand Down
69 changes: 65 additions & 4 deletions tests/validations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ spk hld install-manifest-pipeline --org-name $AZDO_ORG -d $AZDO_PROJECT --person
pipeline_created=$(az pipelines show --name $hld_to_manifest_pipeline_name --org $AZDO_ORG_URL --p $AZDO_PROJECT)

# Verify hld to manifest pipeline run was successful
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 300 15
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 300 15 1

##################################
# External Helm Chart Repo Setup START
Expand Down Expand Up @@ -266,7 +266,7 @@ spk project install-lifecycle-pipeline --org-name $AZDO_ORG --devops-project $AZ
pipeline_created=$(az pipelines show --name $lifecycle_pipeline_name --org $AZDO_ORG_URL --p $AZDO_PROJECT)

# Verify lifecycle pipeline run was successful
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name 180 15
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name 180 15 1

# Approve pull request from lifecycle pipeline
echo "Finding pull request that $lifecycle_pipeline_name pipeline created..."
Expand All @@ -288,7 +288,7 @@ spk service install-build-pipeline --org-name $AZDO_ORG -u $remote_repo_url -d $
pipeline_created=$(az pipelines show --name $frontend_pipeline_name --org $AZDO_ORG_URL --p $AZDO_PROJECT)

# Verify frontend service pipeline run was successful
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $frontend_pipeline_name 300 15
verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $frontend_pipeline_name 300 15 1

echo "Finding pull request that $frontend_pipeline_name pipeline created..."
approve_pull_request $AZDO_ORG_URL $AZDO_PROJECT "Updating $FrontEnd image tag to master"
Expand All @@ -297,6 +297,8 @@ approve_pull_request $AZDO_ORG_URL $AZDO_PROJECT "Updating $FrontEnd image tag t
##################################
# App Mono Repo Service Revision START
##################################
cd $TEST_WORKSPACE
cd $mono_repo_dir

echo "Creating service revision"
git branch $branchName
Expand Down Expand Up @@ -342,6 +344,65 @@ validate_file "$TEST_WORKSPACE/$manifests_dir/prod/$mono_repo_dir/$FrontEndCompl
# Eventually add rings as some stage....
# --------------------------------

# Get the current pipeline/build id at this stage. This will be used by the introspection integration test.
pipeline1id=$(az pipelines build list --definition-ids $pipeline_id --organization $AZDO_ORG_URL --project $AZDO_PROJECT | jq '.[0].id')

##################################
# App Mono Repo create ring
##################################
# verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name 400 15 2
# 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
# verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 400 15 4
# ring_name=qa-ring

# cd $TEST_WORKSPACE
# cd $mono_repo_dir

# echo "Create ring"
# git checkout master
# git pull origin master
# spk ring create $ring_name
# git add -A
# git commit -m "Adding test ring"
# git push -u origin --all

# # Wait for the lifecycle pipeline to finish and approve the pull request
# verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $lifecycle_pipeline_name 300 15 3
# 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
# verify_pipeline_with_poll $AZDO_ORG_URL $AZDO_PROJECT $hld_to_manifest_pipeline_name 300 15 5

# # Verify the file was added 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' does not exist"
# exit 1
# fi

# echo "Validating ingress routes"

# validate_file "$ring_dir/static.yaml" "'PathPrefix(\`/fabrikam-acme-frontend\`) && Headers(\`Ring\`, \`qa-ring\`)'"

# echo "Successfully created a ring."

# --------------------------------
# Push the ring branch
# git branch $ring_name
# git checkout $ring_name


# --------------------------------

echo "Successfully reached the end of the service validations scripts."

# ##################################
Expand All @@ -365,7 +426,7 @@ else
fi

# Compare $pipeline_id with the data returned by get.
pipeline1id=$(az pipelines build list --definition-ids $pipeline_id --organization $AZDO_ORG_URL --project $AZDO_PROJECT | jq '.[0].id')

listofIds=$(cat file.json | jq '.[].srcToDockerBuild.id')

if [[ $listofIds == *"$pipeline1id"* ]]; then
Expand Down