add sanity test boilerplate for groups (#4099)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests

#### Issue(s)

* #3989 

#### Test Plan

- [x] 💚 E2E
This commit is contained in:
Keepers 2023-08-24 14:13:06 -06:00 committed by GitHub
parent 11c6169056
commit f0422431bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 5 deletions

View File

@ -12,7 +12,7 @@ inputs:
required: false required: false
default: "" default: ""
restore-args: restore-args:
description: Arguments to pass for restore description: Arguments to pass for restore; restore is skipped when missing.
required: false required: false
default: "" default: ""
test-folder: test-folder:
@ -28,6 +28,10 @@ inputs:
description: Value for the --collisions flag description: Value for the --collisions flag
requried: false requried: false
default: "replace" default: "replace"
with-export:
description: Runs export tests when true
required: false
default: false
outputs: outputs:
backup-id: backup-id:
@ -52,6 +56,7 @@ runs:
tee $GITHUB_OUTPUT tee $GITHUB_OUTPUT
- name: Restore ${{ inputs.service }} ${{ inputs.kind }} - name: Restore ${{ inputs.service }} ${{ inputs.kind }}
if: inputs.restore != ""
id: restore id: restore
shell: bash shell: bash
working-directory: src working-directory: src
@ -73,6 +78,7 @@ runs:
cat /tmp/corsologs cat /tmp/corsologs
- name: Check restore ${{ inputs.service }} ${{ inputs.kind }} - name: Check restore ${{ inputs.service }} ${{ inputs.kind }}
if: ${{ inputs.restore != "" }}
shell: bash shell: bash
working-directory: src working-directory: src
env: env:
@ -86,10 +92,10 @@ runs:
./sanity-test ./sanity-test
- name: Export ${{ inputs.service }} ${{ inputs.kind }} - name: Export ${{ inputs.service }} ${{ inputs.kind }}
if: ${{ inputs.with-export == true }}
id: export id: export
shell: bash shell: bash
working-directory: src working-directory: src
if: ${{ inputs.service == 'onedrive' || inputs.service == 'sharepoint' }}
run: | run: |
set -euo pipefail set -euo pipefail
CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log
@ -103,9 +109,9 @@ runs:
cat /tmp/corsologs cat /tmp/corsologs
- name: Check export ${{ inputs.service }} ${{ inputs.kind }} - name: Check export ${{ inputs.service }} ${{ inputs.kind }}
if: ${{ inputs.with-export == true }}
shell: bash shell: bash
working-directory: src working-directory: src
if: ${{ inputs.service == 'onedrive' || inputs.service == 'sharepoint' }}
env: env:
SANITY_TEST_KIND: export SANITY_TEST_KIND: export
SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }} SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }}
@ -117,10 +123,10 @@ runs:
./sanity-test ./sanity-test
- name: Export archive ${{ inputs.service }} ${{ inputs.kind }} - name: Export archive ${{ inputs.service }} ${{ inputs.kind }}
if: ${{ inputs.with-export == true }}
id: export-archive id: export-archive
shell: bash shell: bash
working-directory: src working-directory: src
if: ${{ inputs.service == 'onedrive' }} # Export only available for OneDrive
run: | run: |
set -euo pipefail set -euo pipefail
CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log
@ -137,9 +143,9 @@ runs:
cat /tmp/corsologs cat /tmp/corsologs
- name: Check archive export ${{ inputs.service }} ${{ inputs.kind }} - name: Check archive export ${{ inputs.service }} ${{ inputs.kind }}
if: ${{ inputs.with-export == true }}
shell: bash shell: bash
working-directory: src working-directory: src
if: ${{ inputs.service == 'onedrive' }}
env: env:
SANITY_TEST_KIND: export SANITY_TEST_KIND: export
SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }}-unzipped SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }}-unzipped

View File

@ -241,6 +241,7 @@ jobs:
restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' 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 }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
with-export: true
# generate some more enteries for incremental check # generate some more enteries for incremental check
- name: OneDrive - Create new data (for incremental) - name: OneDrive - Create new data (for incremental)
@ -263,6 +264,7 @@ jobs:
restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' 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 }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
with-export: true
########################################################################################################################################## ##########################################################################################################################################
@ -295,6 +297,7 @@ jobs:
restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' 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 }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
with-export: true
# generate some more enteries for incremental check # generate some more enteries for incremental check
- name: SharePoint - Create new data (for incremental) - name: SharePoint - Create new data (for incremental)
@ -318,6 +321,53 @@ jobs:
restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' 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 }}' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }} log-dir: ${{ env.CORSO_LOG_DIR }}
with-export: true
##########################################################################################################################################
# Groups and Teams
# generate new entries for test
- name: Groups - Create new data
if: false # TODO: enable when ready
id: new-data-creation-groups
working-directory: ./src/cmd/factory
run: |
suffix=$(date +"%Y-%m-%d_%H-%M-%S")
go run . sharepoint files \
--site ${{ secrets.CORSO_M365_TEST_GROUPS_SITE_URL }} \
--user ${{ env.TEST_USER }} \
--secondaryuser ${{ env.CORSO_SECONDARY_M365_TEST_USER_ID }} \
--tenant ${{ secrets.TENANT_ID }} \
--destination ${{ env.RESTORE_DEST_PFX }}$suffix \
--count 4
echo result="${suffix}" >> $GITHUB_OUTPUT
- name: Groups - Backup
if: false # TODO: enable when ready
id: groups-backup
uses: ./.github/actions/backup-restore-test
with:
service: groups
kind: initial
backup-args: '--group "${{ secrets.CORSO_M365_TEST_TEAM_ID }}"'
test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }}
- name: Teams - Backup
if: false # TODO: enable when ready
id: teams-backup
uses: ./.github/actions/backup-restore-test
with:
service: teams
kind: initial
backup-args: '--group "${{ secrets.CORSO_M365_TEST_TEAM_ID }}"'
test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
log-dir: ${{ env.CORSO_LOG_DIR }}
# TODO: incrementals
########################################################################################################################################## ##########################################################################################################################################