gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 05/05: dht/client: Test idempotency of cancelling search


From: gnunet
Subject: [gnunet-scheme] 05/05: dht/client: Test idempotency of cancelling searches.
Date: Tue, 15 Feb 2022 11:03:29 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 14d5c4e6c6e0e75ab15a0d912c7f5d619eb8665a
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Tue Feb 15 10:01:32 2022 +0000

    dht/client: Test idempotency of cancelling searches.
    
    * tests/distributed-hash-table.scm
      (simulate-dht-service): Handle msg:dht:client:get:stop messages
      somewhat.
      ("cancelling a search multiple times does not hang"): New test.
---
 tests/distributed-hash-table.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 84787bc..9671a46 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -434,7 +434,7 @@
 ;; (gnu gnunet dht service).
 (define (simulate-dht-service)
   "Simulate a DHT service, remembering all insertions and ignoring expiration
-and replication.  Cancellation is not supported.  Only a single client is
+and replication.  Cancellation is ignored (TODO).  Only a single client is
 supported."
   (define (slice->bv slice)
     (define bv (make-bytevector (slice-length slice)))
@@ -521,6 +521,10 @@ supported."
                 (simple-message-handler
                  (symbol-value message-type msg:dht:client:put)
                  handle/put!)
+                ;; TODO: handle properly
+                (simple-message-handler
+                 (symbol-value message-type msg:dht:client:get:stop)
+                 (lambda (slice) (values)))
                 (simple-message-handler
                  (symbol-value message-type msg:dht:client:get)
                  handle/start-get!))))
@@ -778,4 +782,18 @@ supported."
      (wait done)
      #true)))
 
+(test-assert "cancelling a search multiple times does not hang"
+  (call-with-services/fibers
+   `(("dht" . ,(simulate-dht-service)))
+   (lambda (config spawn-fiber)
+     (define server (connect config))
+     (define datum (make-a-datum))
+     (define query (make-query (datum-type datum) (datum-key datum)))
+     (define search (start-get! server query (lambda (foo) (values))))
+     (let loop ((n 0))
+       (when (< n 40)
+        (stop-get! search)
+        (loop (+ n 1))))
+     #true)))
+
 (test-end)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]