diff --git a/services/spar/test-integration/Test/Spar/APISpec.hs b/services/spar/test-integration/Test/Spar/APISpec.hs index 315d798378..6d0e207baa 100644 --- a/services/spar/test-integration/Test/Spar/APISpec.hs +++ b/services/spar/test-integration/Test/Spar/APISpec.hs @@ -1669,22 +1669,25 @@ specReAuthSsoUserWithPassword = newClientVerificationCode = Nothing } - deleteClient :: (MonadIO m, MonadReader TestEnv m) => BrigReq -> UserId -> ClientId -> Maybe Text -> Int -> m () - deleteClient brig u c pw expectedStatus = - void $ - call $ - delete $ - brig - . paths ["clients", toByteString' c] - . zUser u - . zConn "conn" - . contentJson - . body payload - . expectStatus ((==) expectedStatus) + deleteClient :: (HasCallStack, MonadIO m, MonadReader TestEnv m) => BrigReq -> UserId -> ClientId -> Maybe Text -> Int -> m () + deleteClient brig u c pw expectedStatus = do + resp <- + retryNUntil transientRetries (\r -> statusCode r `notElem` transientStatuses) $ + call $ + delete $ + brig + . paths ["clients", toByteString' c] + . zUser u + . zConn "conn" + . contentJson + . body payload + liftIO $ statusCode resp `shouldBe` expectedStatus where payload = RequestBodyLBS . encode . object . maybeToList $ fmap ("password" .=) pw + transientStatuses = [500, 502, 503, 504] + transientRetries = 10 ---------------------------------------------------------------------- -- tests for bsi audit