smartsheet / smartsheet-java-sdk

Library that uses Java to connect to Smartsheet services.
Apache License 2.0
3 stars 12 forks source link

flakey tests due to create/read edge-case #99

Open ronreynolds opened 1 month ago

ronreynolds commented 1 month ago

i believe this test failure is due to a create/read request pair that's too close together.

the most likely reason is replication-delay between the grid-shard-db's writable primary and the read-only replica from which another server tried to read (if it was the same server it would have found a cached copy of the grid). i believe grid-reads are always from replica so if you quickly create a new sheet and there's replication lag trying to read it back will result in a failure to find the sheet in the grid-shard-db replica).

not sure what the fix is - just introducing lag is silly; possibly some fault-tolerance with retry + backoff?

SheetResourcesIT > testSheetMethods() FAILED
    com.smartsheet.api.ResourceNotFoundException: Not Found
        at java.base@11.0.24/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base@11.0.24/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base@11.0.24/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base@11.0.24/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at app//com.smartsheet.api.internal.AbstractResources$ErrorCode.getException(AbstractResources.java:144)
        at app//com.smartsheet.api.internal.AbstractResources.handleError(AbstractResources.java:874)
        at app//com.smartsheet.api.internal.AbstractResources.listResourcesWithWrapper(AbstractResources.java:496)
        at app//com.smartsheet.api.internal.SheetColumnResourcesImpl.listColumns(SheetColumnResourcesImpl.java:122)
        at app//com.smartsheet.api.internal.SheetColumnResourcesImpl.listColumns(SheetColumnResourcesImpl.java:82)
        at app//com.smartsheet.api.integrationtest.SheetResourcesIT.testCreateUpdateRequest(SheetResourcesIT.java:152)
        at app//com.smartsheet.api.integrationtest.SheetResourcesIT.testSheetMethods(SheetResourcesIT.java:98)
ronreynolds commented 1 month ago

another one? https://github.com/smartsheet/smartsheet-java-sdk/actions/runs/10328241018/job/28594521252?pr=88#step:5:317 (it appears Folder was created but then not found in the subsequent listFolders call)


FolderResourcesIT > testFolderMethods() FAILED
    org.opentest4j.AssertionFailedError: 
    expected: 1
     but was: 0
        at java.base@11.0.24/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base@11.0.24/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base@11.0.24/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at app//com.smartsheet.api.integrationtest.FolderResourcesIT.testListFoldersInFolder(FolderResourcesIT.java:102)
        at app//com.smartsheet.api.integrationtest.FolderResourcesIT.testFolderMethods(FolderResourcesIT.java:55)