atsign-foundation / at_client_sdk

The Dart implementation of atSDK used for implementing Atsign's technology into other software
https://pub.dev/publishers/atsign.org/packages
BSD 3-Clause "New" or "Revised" License
1.47k stars 32 forks source link

end2end test failure in collection test #1267

Closed murali-shris closed 3 months ago

murali-shris commented 3 months ago

Describe the bug

https://github.com/atsign-foundation/at_client_sdk/actions/runs/8373572103/job/22927728963 Model operations - unshare() and delete() test fails in github actions

Steps to reproduce

test should pass

Screenshots

No response

Smartphones

Were you using an atApplication when the bug was found?

No response

Additional context

No response

murali-shris commented 3 months ago

@gkc @cpswan There seems to be a race condition(getKeys happens before save completes) in collections implementation. We are currently not using collections model in any of our apps. Temporarily commented collections test to unblock at_client release. I am downgrading the severity from P1 to P2.

sitaram-kalluri commented 3 months ago

The root cause of the test - "Model operations - unshare() and delete() test" failure is because there are two matching the regex, but the test expects only one key.

The following expects only one shared key which is sharedWith ce2e2 - expect(await fourthPhone.sharedWith(), ['@ce2e2']);; but the "getKeys" returns two shared keys (please refer to the screenshot attached) and the test fails with the below error.

Expected: ['@ce2e2'] Actual: ['@ce2e2', '@ce2e2'] Which: at location [1] is ['@ce2e2', '@ce2e2'] which longer than expected

The keys "ce2e2:123-personal-phone.phone.atcollectionmodel.buzz.wavi@ce2e1" and "ce2e2:personal-phone.phone.atcollectionmodel.buzz.wavi@ce2e1" are two shared keys returned. Screenshot from 2024-03-28 07-38-10

To fix the issue, will generate a random number string and append to the id to make key unique for each run.