From 348d451cb0e803ea74c96267932277b38d0eb43d Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Sat, 28 Oct 2023 06:47:17 -0400 Subject: [PATCH] Cleanup tests. --- .github/workflows/project.yaml | 42 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/project.yaml b/.github/workflows/project.yaml index dd449356..ca791dfc 100644 --- a/.github/workflows/project.yaml +++ b/.github/workflows/project.yaml @@ -107,7 +107,7 @@ jobs: git config --global user.email "$TEST_USER_EMAIL" git config --global user.name "$TEST_USER_NAME" git branch - - name: "[create_project] 3. Set remote." + - name: "[create_project] 3. Set remote to the Upsun test project." run: | echo "::notice::Setting remote for the project locally." TEST_PROJECT_ID=$(upsun project:list -o "$TEST_ORG_NAME" --title "$TEST_PROJECT_TITLE" --pipe) @@ -126,46 +126,44 @@ jobs: # Push through Git, not the CLI, so the exit doesn't break the workflow. git push --force upsun $TEST_PROJECT_DEFAULT_BRANCH # upsun push -f -y - - name: "[first_deploy] 2. Test: Verify first failure." + - name: "[first_deploy] 2. Test: The first deploy activity should complete." + run: | + cd $TEST_PROJECT_LOCALDIR + ./utils/tests/activity_outcome.sh $TEST_PROJECT_DEFAULT_BRANCH push state complete "first_push" + - name: "[first_deploy] 3. Test: The first deploy activity should fail." run: | cd $TEST_PROJECT_LOCALDIR - - # Verify complete. - ./utils/tests/activity_outcome.sh $TEST_PROJECT_DEFAULT_BRANCH push state complete "first_push" - - # Verify failure. ./utils/tests/activity_outcome.sh $TEST_PROJECT_DEFAULT_BRANCH push result failure "first_push" - - name: "[first_deploy] 3. Set initial resources." + ################################################################################################ + # D. Set initial resources. + - name: "[first_resources] 1. Set initial resources." run: | cd $TEST_PROJECT_LOCALDIR upsun resources:set --size '*:0.1' -y - - name: "[first_deploy] 4. Test: verify activity completed." + - name: "[first_resources] 2. Test: The update environment resources activity should complete." run: | cd $TEST_PROJECT_LOCALDIR - - # Verify complete. ./utils/tests/activity_outcome.sh $TEST_PROJECT_DEFAULT_BRANCH environment.resources.update state complete "first_push" - - - name: "[first_deploy] 5. Test: verify activity has succeeded." + - name: "[first_resources] 3. Test: The update environment resources activity should succeed." run: | cd $TEST_PROJECT_LOCALDIR - - # Verify success. ./utils/tests/activity_outcome.sh $TEST_PROJECT_DEFAULT_BRANCH environment.resources.update result success "first_push" - - - name: "[first_deploy] 6. Test: production URLS & endpoint data." + - name: "[first_resources] 4. Test: Updating environment resources should result in a 200 on the frontend production app." run: | cd $TEST_PROJECT_LOCALDIR - - # Verify frontend deployment successful. TEST_PROJECT_PROD_URL_FRONTEND=$(upsun url --primary --pipe) ./utils/tests/url_status.sh $TEST_PROJECT_PROD_URL_FRONTEND '200' "production frontend deployment" - - # Verify frontend deployment successful. + - name: "[first_resources] 5. Test: Updating environment resources should result in a 200 on the backend production app." + run: | + cd $TEST_PROJECT_LOCALDIR TEST_PROJECT_PROD_URL_BACKEND=$TEST_PROJECT_PROD_URL_FRONTEND$TEST_PROJECT_BACKEND_PATH - ./utils/tests/url_status.sh $TEST_PROJECT_PROD_URL_FRONTEND '200' "production frontend deployment" + ./utils/tests/url_status.sh $TEST_PROJECT_PROD_URL_BACKEND '200' "production backend deployment" + - name: "[first_resources] 6. Test: endpoint data." + run: | + cd $TEST_PROJECT_LOCALDIR + EXPECTED_STATUS="file" STATUS_DATA=$(curl -s $TEST_PROJECT_PROD_URL_BACKEND | jq -r '.session_storage') if [ "$STATUS_DATA" != "$EXPECTED_STATUS" ]; then