From 14288a9e23669b36fc3a4091d7757a227bf43aee Mon Sep 17 00:00:00 2001 From: John Ingve Olsen Date: Wed, 8 Jul 2020 08:50:40 +0200 Subject: [PATCH] tests/ordering: removed dead code and fixed QF Since we're now using maps in QF, we can no longer simply return index 0 --- tests/ordering/order_test.go | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/tests/ordering/order_test.go b/tests/ordering/order_test.go index fa814032..fb467b6f 100644 --- a/tests/ordering/order_test.go +++ b/tests/ordering/order_test.go @@ -2,8 +2,6 @@ package ordering import ( "context" - "fmt" - "net" "sync" "testing" "time" @@ -13,25 +11,6 @@ import ( "google.golang.org/grpc" ) -type portSupplier struct { - p int - sync.Mutex -} - -func (p *portSupplier) get() int { - p.Lock() - newPort := p.p - p.p++ - p.Unlock() - return newPort -} - -var supplier = portSupplier{p: 22332} - -func getListener() (net.Listener, error) { - return net.Listen("tcp", fmt.Sprintf(":%d", supplier.get())) -} - type testSrv struct { sync.Mutex lastNum uint64 @@ -78,7 +57,11 @@ func (q testQSpec) qf(replies map[uint32]*Response) (*Response, bool) { return reply, true } } - return replies[0], true + var reply *Response + for _, r := range replies { + reply = r + } + return reply, true } func (q testQSpec) QCQF(_ *Request, replies map[uint32]*Response) (*Response, bool) {