fix sanity test for groups (#4226)
<!-- PR description--> Handle- - empty channel - do to add item if deleted #### Does this PR need a docs update or release note? - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🐛 Bugfix #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [ ] ⚡ Unit test
This commit is contained in:
parent
a1a33a2c2d
commit
75c5cb3582
51
.github/workflows/sanity-test.yaml
vendored
51
.github/workflows/sanity-test.yaml
vendored
@ -328,36 +328,35 @@ jobs:
|
||||
|
||||
# Groups and Teams
|
||||
|
||||
# TODO(ashmrtn): Reenable when delta request issue is resolved.
|
||||
# generate new entries for test
|
||||
- name: Groups - Create new data
|
||||
id: new-data-creation-groups
|
||||
working-directory: ./src/cmd/factory
|
||||
run: |
|
||||
suffix=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
|
||||
## generate new entries for test
|
||||
#- name: Groups - Create new data
|
||||
# id: new-data-creation-groups
|
||||
# working-directory: ./src/cmd/factory
|
||||
# run: |
|
||||
# suffix=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
go run . sharepoint files \
|
||||
--site ${{ vars.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
|
||||
|
||||
# go run . sharepoint files \
|
||||
# --site ${{ vars.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
|
||||
|
||||
# echo result="${suffix}" >> $GITHUB_OUTPUT
|
||||
- name: Groups - Backup
|
||||
id: groups-backup
|
||||
uses: ./.github/actions/backup-restore-test
|
||||
with:
|
||||
service: groups
|
||||
kind: initial
|
||||
backup-args: '--group "${{ vars.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: Groups - Backup
|
||||
# id: groups-backup
|
||||
# uses: ./.github/actions/backup-restore-test
|
||||
# with:
|
||||
# service: groups
|
||||
# kind: initial
|
||||
# backup-args: '--group "${{ vars.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
|
||||
# Since it will be alias, will reenable if required
|
||||
# - name: Teams - Backup
|
||||
# id: teams-backup
|
||||
# uses: ./.github/actions/backup-restore-test
|
||||
# with:
|
||||
|
||||
@ -67,6 +67,7 @@ const (
|
||||
MysiteURLNotFound errorMessage = "unable to retrieve user's mysite url"
|
||||
MysiteNotFound errorMessage = "user's mysite not found"
|
||||
NoSPLicense errorMessage = "Tenant does not have a SPO license"
|
||||
parameterDeltaTokenNotSupported errorMessage = "Parameter 'DeltaToken' not supported for this request"
|
||||
usersCannotBeResolved errorMessage = "One or more users could not be resolved"
|
||||
)
|
||||
|
||||
@ -134,6 +135,7 @@ func IsErrItemNotFound(err error) bool {
|
||||
|
||||
func IsErrInvalidDelta(err error) bool {
|
||||
return hasErrorCode(err, syncStateNotFound, resyncRequired, syncStateInvalid) ||
|
||||
hasErrorMessage(err, parameterDeltaTokenNotSupported) ||
|
||||
errors.Is(err, ErrInvalidDelta)
|
||||
}
|
||||
|
||||
@ -279,7 +281,7 @@ func hasErrorMessage(err error, msgs ...errorMessage) bool {
|
||||
cs[i] = string(c)
|
||||
}
|
||||
|
||||
return filters.Equal(cs).Compare(msg)
|
||||
return filters.Contains(cs).Compare(msg)
|
||||
}
|
||||
|
||||
// Wrap is a helper function that extracts ODataError metadata from
|
||||
|
||||
@ -198,6 +198,11 @@ func (suite *GraphErrorsUnitSuite) TestIsErrInvalidDelta() {
|
||||
err: odErr("fnords"),
|
||||
expect: assert.False,
|
||||
},
|
||||
{
|
||||
name: "non-matching oDataErrMsg",
|
||||
err: odErrMsg("fnords", "deltatoken not supported"),
|
||||
expect: assert.False,
|
||||
},
|
||||
{
|
||||
name: "resync-required oDataErr",
|
||||
err: odErr(string(resyncRequired)),
|
||||
@ -208,6 +213,11 @@ func (suite *GraphErrorsUnitSuite) TestIsErrInvalidDelta() {
|
||||
err: odErr(string(syncStateInvalid)),
|
||||
expect: assert.True,
|
||||
},
|
||||
{
|
||||
name: "deltatoken not supported oDataErrMsg",
|
||||
err: odErrMsg("fnords", string(parameterDeltaTokenNotSupported)),
|
||||
expect: assert.True,
|
||||
},
|
||||
// next two tests are to make sure the checks are case insensitive
|
||||
{
|
||||
name: "resync-required oDataErr camelcase",
|
||||
|
||||
@ -119,6 +119,15 @@ func (c Channels) GetChannelMessageIDsDelta(
|
||||
continue
|
||||
}
|
||||
|
||||
if graph.IsErrInvalidDelta(err) {
|
||||
logger.Ctx(ctx).Infow("delta token not supported", "delta_link", prevDelta)
|
||||
|
||||
added = map[string]struct{}{}
|
||||
deleted = map[string]struct{}{}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, DeltaUpdate{}, graph.Wrap(ctx, err, "retrieving page of channel messages")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user