test-scs-modify-bookmarks: wait for warm bookmark cache to update

Summary:
The recent change to make `list-bookmarks` read from the warm bookmark cache
has made this test flaky, as we must wait for the warm bookmark cache to update
before the new values are visible.

Update `wait_for_bookmark_update` to use `list-bookmarks` which always uses
the warm bookmark cache.  A similar function is also needed for bookmark deletion.

Reviewed By: StanislavGlebik

Differential Revision: D26816627

fbshipit-source-id: e99b83454070d565646b069177e18bd6a01946ae
This commit is contained in:
Mark Juggurnauth-Thomas 2021-03-04 10:17:56 -08:00 committed by Facebook GitHub Bot
parent 9a7c51ef9c
commit 7eb0817dbd

View File

@ -13,7 +13,7 @@ Bookmark moves are asynchronous. Function to wait for the move to happen.
> local target=$3
> local attempt=1
> sleep 1
> while [[ "$(scsc lookup -R $repo -B $bookmark)" != "$target" ]]
> while ! scsc list-bookmarks -R $repo --prefix $bookmark 2>/dev/null | grep -q "^$bookmark *$target$"
> do
> attempt=$((attempt + 1))
> if [[ $attempt -gt 5 ]]
@ -24,6 +24,22 @@ Bookmark moves are asynchronous. Function to wait for the move to happen.
> sleep 1
> done
> }
$ wait_for_bookmark_delete() {
> local repo=$1
> local bookmark=$2
> local attempt=1
> sleep 1
> while scsc lookup -R $repo -B $bookmark 2>/dev/null
> do
> attempt=$((attempt + 1))
> if [[ $attempt -gt 5 ]]
> then
> echo "bookmark deletion of $bookmark has not happened"
> return 1
> fi
> sleep 1
> done
> }
Setup config repo:
$ INFINITEPUSH_ALLOW_WRITES=true \
@ -274,6 +290,9 @@ restricted services can't if they don't have the method permission
error: SourceControlService::repo_delete_bookmark failed with RequestError { kind: RequestErrorKind::PERMISSION_DENIED, reason: "permission denied: service restricted-service is not permitted to call method delete_bookmark in repo" }
[1]
wait for the warm bookmark cache to update (last successful delete was for newindigo)
$ wait_for_bookmark_delete repo newindigo
$ scsc list-bookmarks -R repo
newgolf 6fa3874a3b67598ec503160c8925af79d98522d6
other 9ff3b7f3228023fe93f2bb7f033da2541f78e725