From b9344fc066cf92e3e1fabbdb8e417e881dc03ac6 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 23 May 2023 17:46:00 -0600 Subject: [PATCH] update sanity test log files (#3486) #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :bug: Bugfix - [x] :computer: CI/Deployment #### Test Plan - [x] :zap: Unit test - [x] :green_heart: E2E --- .../actions/backup-restore-test/action.yml | 10 ++++- .github/workflows/sanity-test.yaml | 43 ++++++++++--------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/actions/backup-restore-test/action.yml b/.github/actions/backup-restore-test/action.yml index 10f81cbb0..4e31ad836 100644 --- a/.github/actions/backup-restore-test/action.yml +++ b/.github/actions/backup-restore-test/action.yml @@ -21,6 +21,9 @@ inputs: base-backup: description: Base backup to use for testing required: false + log-dir: + description: Folder to store test log files + required: true outputs: backup-id: @@ -35,6 +38,7 @@ runs: working-directory: src run: | set -euo pipefail + CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-backup-${{ inputs.service }}-${{inputs.kind }}.log ./corso backup create '${{ inputs.service }}' \ --no-stats --hide-progress --json \ ${{ inputs.backup-args }} | @@ -49,6 +53,7 @@ runs: working-directory: src run: | set -euo pipefail + CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log ./corso restore '${{ inputs.service }}' \ --no-stats \ --hide-progress \ @@ -71,6 +76,7 @@ runs: TEST_DATA: ${{ inputs.test-folder }} BASE_BACKUP: ${{ inputs.base-backup }} run: | + CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-validate-${{ inputs.service }}-${{inputs.kind }}.log ./sanity-test - name: List ${{ inputs.service }} ${{ inputs.kind }} @@ -78,6 +84,7 @@ runs: working-directory: src run: | set -euo pipefail + CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-backup-list-${{ inputs.service }}-${{inputs.kind }}.log ./corso backup list ${{ inputs.service }} \ --no-stats \ --hide-progress \ @@ -95,6 +102,7 @@ runs: working-directory: src run: | set -euo pipefail + CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-backup-list-single-${{ inputs.service }}-${{inputs.kind }}.log ./corso backup list ${{ inputs.service }} \ --no-stats \ --hide-progress \ @@ -114,6 +122,6 @@ runs: uses: actions/upload-artifact@v3 with: name: "${{ inputs.service }}-${{ inputs.kind }}-logs" - path: ${{ env.WORKING_DIR }}/${{ env.CORSO_LOG_DIR }}/ + path: ${{ inputs.log-dir }}/* if-no-files-found: error retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index 3480f3200..7a8e110f1 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -35,23 +35,20 @@ jobs: AZURE_TENANT_ID: ${{ secrets.TENANT_ID }} CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }} # re-used values - # don't forget: return to Corso_Test_Sanity_ - CORSO_LOG_DIR: testlog + CORSO_LOG_DIR: ${{ github.workspace }}/src/testlog CORSO_LOG_FILE: ${{ github.workspace }}/src/testlog/run-sanity.log RESTORE_DEST_PFX: Corso_Test_Sanity_ TEST_RESULT: test_results TEST_USER: ${{ github.event.inputs.user != '' && github.event.inputs.user || secrets.CORSO_M365_TEST_USER_ID }} - # The default working directory doesn't seem to apply to things without - # the 'run' directive. https://stackoverflow.com/a/67845456 - WORKING_DIR: src defaults: run: - working-directory: ${{ env.WORKING_DIR }} - steps: + working-directory: src + ########################################################################################################################################## # setup + steps: - uses: actions/checkout@v3 @@ -117,8 +114,6 @@ jobs: - name: Repo init test id: repo-init - env: - TEST_RESULT: "test_results" run: | set -euo pipefail prefix=$(date +"%Y-%m-%d-%T") @@ -128,9 +123,9 @@ jobs: --hide-progress \ --prefix $prefix \ --bucket ${{ secrets.CI_TESTS_S3_BUCKET }} \ - 2>&1 | tee $TEST_RESULT/initrepo.txt + 2>&1 | tee ./testlogs/gotest-repo-init.log - if ! grep -q 'Initialized a S3 repository within bucket' $TEST_RESULT/initrepo.txt + if ! grep -q 'Initialized a S3 repository within bucket' ./$TEST_RESULT/gotest-repo-init.log then echo "Repo could not be initialized" exit 1 @@ -147,9 +142,9 @@ jobs: --hide-progress \ --prefix ${{ steps.repo-init.outputs.result }} \ --bucket ${{ secrets.CI_TESTS_S3_BUCKET }} \ - 2>&1 | tee $TEST_RESULT/connect.txt + 2>&1 | tee ./testlogs/gotest-repo-connect.log - if ! grep -q 'Connected to S3 bucket' $TEST_RESULT/connect.txt + if ! grep -q 'Connected to S3 bucket' ./testlogs/gotest-repo-connect.log then echo "Repo could not be connected" exit 1 @@ -175,43 +170,47 @@ jobs: uses: ./.github/actions/backup-restore-test with: service: exchange - kind: backup + kind: initial backup-args: '--mailbox "${{ env.TEST_USER }}" --data "email"' restore-args: '--email-folder ${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} - name: Exchange - Incremental backup id: exchange-backup-incremental uses: ./.github/actions/backup-restore-test with: service: exchange - kind: backup-incremental + kind: incremental backup-args: '--mailbox "${{ env.TEST_USER }}" --data "email"' restore-args: '--email-folder ${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' base-backup: ${{ steps.exchange-backup.outputs.backup-id }} + log-dir: ${{ env.CORSO_LOG_DIR }} - name: Exchange - Non delta backup id: exchange-backup-non-delta uses: ./.github/actions/backup-restore-test with: service: exchange - kind: backup-non-delta + kind: non-delta backup-args: '--mailbox "${{ env.TEST_USER }}" --data "email" --disable-delta' restore-args: '--email-folder ${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' base-backup: ${{ steps.exchange-backup.outputs.backup-id }} + log-dir: ${{ env.CORSO_LOG_DIR }} - name: Exchange - Incremental backup after non-delta id: exchange-backup-incremental-after-non-delta uses: ./.github/actions/backup-restore-test with: service: exchange - kind: backup-incremental-after-non-delta + kind: non-delta-incremental backup-args: '--mailbox "${{ env.TEST_USER }}" --data "email"' restore-args: '--email-folder ${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.repo-init.outputs.result }}' base-backup: ${{ steps.exchange-backup.outputs.backup-id }} + log-dir: ${{ env.CORSO_LOG_DIR }} ########################################################################################################################################## @@ -239,10 +238,11 @@ jobs: uses: ./.github/actions/backup-restore-test with: service: onedrive - kind: backup + kind: initial backup-args: '--user "${{ env.TEST_USER }}"' restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} # generate some more enteries for incremental check - name: OneDrive - Create new data (for incremental) @@ -264,6 +264,7 @@ jobs: backup-args: '--user "${{ env.TEST_USER }}"' restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} ########################################################################################################################################## @@ -291,10 +292,11 @@ jobs: uses: ./.github/actions/backup-restore-test with: service: sharepoint - kind: backup + kind: initial backup-args: '--site "${{ secrets.CORSO_M365_TEST_SITE_URL }}"' restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} # generate some more enteries for incremental check - name: SharePoint - Create new data (for incremental) @@ -317,6 +319,7 @@ jobs: backup-args: '--site "${{ secrets.CORSO_M365_TEST_SITE_URL }}"' restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} ########################################################################################################################################## @@ -328,7 +331,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: sanity-test-log - path: ${{ github.workspace }}/${{ env.CORSO_LOG_DIR }}/ + path: ${{ env.CORSO_LOG_DIR }}/* if-no-files-found: error retention-days: 14