mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 06:22:43 +00:00
directory: test that an answered search request frees its place under the in-flight cap
The busy test used a cap of 0 and the other tests stayed under the cap, so losing the release would have passed the suite while every search after the eighth was refused as "service is busy". With a cap of 1, two searches in a row must both be answered. Review: R1-A1
This commit is contained in:
1 parent
5f6030568e
commit
efa6906a84
1 file changed
+12
@@ -76,6 +76,7 @@ directoryServiceTests = do
|
||||
it "should page search over service RPC by the echoed cursor" testDirectorySearchRpcPaging
|
||||
it "should match LIKE wildcards in search text literally" testDirectorySearchRpcLiteral
|
||||
it "should reject service requests over the cap" testDirectorySearchRpcBusy
|
||||
it "should take a new service request once the previous one is answered" testDirectorySearchRpcSlotReleased
|
||||
it "should send every entry field the apps render" testDirectorySearchEntryFields
|
||||
it "should send a channel entry with its published link" testDirectorySearchChannelEntry
|
||||
it "should drop an oversize image and keep the entry" testSearchEntryImageBound
|
||||
@@ -768,6 +769,17 @@ testDirectorySearchRpcBusy ps =
|
||||
cath ##> ("/_service_request 1 " <> dsShortLink <> " {\"type\":\"search\",\"searchText\":\"privacy\"}")
|
||||
cath <## "smp agent error: AGENT {agentErr = A_SERVICE {serviceError = ASERejected {rejectReason = \"service is busy\"}}}"
|
||||
|
||||
testDirectorySearchRpcSlotReleased :: HasCallStack => TestParams -> IO ()
|
||||
testDirectorySearchRpcSlotReleased ps =
|
||||
withDirectoryServiceOptsLinks ps (\o -> o {maxServiceRequestsInFlight = 1}) $ \_superUser (dsShortLink, _) ->
|
||||
withNewTestChat ps "cath" cathProfile $ \cath -> do
|
||||
let search = cath ##> ("/_service_request 1 " <> dsShortLink <> " {\"type\":\"search\",\"searchText\":\"nothing matches this\"}")
|
||||
noResults = "service response: {\"entries\":[],\"moreCount\":0,\"pageSize\":3,\"type\":\"searchResults\"}"
|
||||
search
|
||||
cath <## noResults
|
||||
search
|
||||
cath <## noResults
|
||||
|
||||
-- Read from the controller, not the terminal: an entry with an image is longer than a terminal
|
||||
-- row, and the test terminal only queues the last row of a line that wrapped.
|
||||
searchDirectoryCounts :: TestCC -> String -> String -> Maybe J.Value -> IO ([DirectorySearchEntry], Maybe J.Value, Int, Int)
|
||||
|
||||
Reference in new issue
Block a user