diff options
author | Sawjan Gurung <saw.jan.grg3e@gmail.com> | 2022-10-19 07:22:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 07:22:16 +0300 |
commit | ccf6abbfc0f3ed5a80f8d2a7680ab8a5586fd992 (patch) | |
tree | 0e5015c8ca385779222dc4bcd783e1539f0f03b4 /test | |
parent | dc15c26500c2f6497366589a367adabb0b1e5311 (diff) |
check the last sync status if sync pattern doesn't match (#10191)
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/shared/steps/steps.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 767f116ef..ca274773a 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -85,10 +85,17 @@ def listenSyncStatusForItem(item, type='FOLDER'): socketConnect.sendCommand("RETRIEVE_" + type + "_STATUS:" + item + "\n") +def getCurrentSyncStatus(resource, resourceType): + listenSyncStatusForItem(resource, resourceType) + messages = filterMessagesForItem(readSocketMessages(), resource) + # return the last message from the list + return messages[-1] + + def waitForFileOrFolderToSync( context, resource='', resourceType='FOLDER', patterns=None ): - resource = join(context.userData['currentUserSyncPath'], resource) + resource = join(context.userData['currentUserSyncPath'], resource).rstrip('/') listenSyncStatusForItem(resource, resourceType) timeout = context.userData['maxSyncTimeout'] * 1000 @@ -102,11 +109,26 @@ def waitForFileOrFolderToSync( ) clearSocketMessages(resource) if not synced: - raise Exception( - "Timeout while waiting for sync to complete for " - + str(timeout) - + " milliseconds" - ) + # if the sync pattern doesn't match then check the last sync status + # and pass the step if the last sync status is STATUS:OK + status = getCurrentSyncStatus(resource, resourceType) + if status.startswith(SYNC_STATUS['OK']): + test.log( + "[WARN] Failed to match sync pattern for resource: " + + resource + + "\nBut its last status is " + + "'" + + SYNC_STATUS['OK'] + + "'" + + ". So passing the step." + ) + return + else: + raise Exception( + "Timeout while waiting for sync to complete for " + + str(timeout) + + " milliseconds" + ) def waitForInitialSyncToComplete(context): |