From ff6334131aeb8aa1b01ba98e678b1f8b31aeb6b5 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 16 May 2023 23:55:40 -0600 Subject: [PATCH] purge sanity tests after run (#3433) #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :robot: Supportability/Tests #### Issue(s) * #3431 #### Test Plan - [x] :green_heart: E2E --- .github/workflows/sanity-test.yaml | 54 ++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index 1cb2e5650..39bdf4c5d 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -3,7 +3,6 @@ on: push: branches: - main - - 3135-logic workflow_dispatch: inputs: user: @@ -50,6 +49,10 @@ jobs: run: working-directory: ${{ env.WORKING_DIR }} steps: +########################################################################################################################################## + +# setup + - uses: actions/checkout@v3 - name: Setup Golang with cache @@ -63,6 +66,51 @@ jobs: - run: mkdir ${TEST_RESULT} - run: mkdir ${CORSO_LOG_DIR} +########################################################################################################################################## + +# Pre-Run cleanup + + # unlike CI tests, sanity tests are not expected to run concurrently. + # however, the sanity yaml concurrency is set to a maximum of 1 run, preferring + # the latest release. If we wait to clean up the production til after the tests + # It would be possible to complete all the testing but cancel the run before + # cleanup occurs. Setting the cleanup before the tests ensures we always begin + # with a clean slate, and cannot compound data production. + - name: Set purge boundary + if: always() + run: | + echo "NOW=$(date +"%Y-%m-%d_%H-%M-%S")" >> $GITHUB_ENV + + - name: Purge CI-Produced Folders for Users + uses: ./.github/actions/purge-m365-data + with: + user: ${TEST_USER} + folder-prefix: ${RESTORE_DEST_PFX} + older-than: ${{ env.NOW }} + azure-client-id: ${AZURE_CLIENT_ID} + azure-client-secret: ${AZURE_CLIENT_SECRET} + azure-tenant-id: ${AZURE_TENANT_ID} + m365-admin-user: ${{ secrets.M365_TENANT_ADMIN_USER }} + m365-admin-password: ${{ secrets.M365_TENANT_ADMIN_PASSWORD }} + + - name: Purge CI-Produced Folders for Sites + if: always() + uses: ./.github/actions/purge-m365-data + with: + site: ${TEST_SITE} + folder-prefix: ${RESTORE_DEST_PFX} + libraries: ${{ vars.CORSO_M365_TEST_SITE_LIBRARIES }} + older-than: ${{ env.NOW }} + azure-client-id: ${AZURE_CLIENT_ID} + azure-client-secret: ${AZURE_CLIENT_SECRET} + azure-tenant-id: ${AZURE_TENANT_ID} + m365-admin-user: ${{ secrets.M365_TENANT_ADMIN_USER }} + m365-admin-password: ${{ secrets.M365_TENANT_ADMIN_PASSWORD }} + +########################################################################################################################################## + +# Repository commands + - name: Version Test run: | ./corso --version | grep -c 'Corso version:' @@ -266,7 +314,7 @@ jobs: ########################################################################################################################################## -# Logging & Notify +# Logging & Notifications # Upload the original go test output as an artifact for later review. - name: Upload test log @@ -307,4 +355,4 @@ jobs: } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file