Skip to content

Commit e8aa996

Browse files
committed
chore: minor tweaks
Just wanted to check if this issue still persists (it does), but thought I just make a few tweaks while I was at it.
1 parent 5b5e8c1 commit e8aa996

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/all2all/alltoallconfig_test.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package all2all
22

33
import (
4-
context "context"
4+
"context"
55
"flag"
66
"fmt"
77
"net"
@@ -43,19 +43,19 @@ func createReplicas(numReplicas int) ([]*replica, error) {
4343
replicas := make([]*replica, numReplicas)
4444
errChan := make(chan error, numReplicas)
4545
startedChan := make(chan struct{}, numReplicas)
46-
for i := 1; i <= numReplicas; i++ {
46+
for i := range replicas {
4747
lis, err := net.Listen("tcp", "127.0.0.1:0")
4848
if err != nil {
4949
return nil, err
5050
}
51-
replica := replica{
51+
replica := &replica{
5252
address: lis.Addr().String(),
5353
id: uint32(i),
5454
lis: lis,
5555
server: gorums.NewServer(),
5656
}
5757
RegisterSampleServer(replica.server, replica)
58-
replicas[i-1] = &replica
58+
replicas[i] = replica
5959
go func() {
6060
startedChan <- struct{}{}
6161
if err := replica.serve(); err != nil {
@@ -100,8 +100,7 @@ func (r replica) WriteQC(ctx gorums.ServerCtx, request *WriteRequest) (response
100100
func (r *replica) createConfiguration(nodeMap map[string]uint32) error {
101101
r.mgr = NewManager(gorums.WithDialTimeout(100*time.Millisecond),
102102
gorums.WithGrpcDialOptions(
103-
grpc.WithBlock(), // block until connections are made
104-
grpc.WithTransportCredentials(insecure.NewCredentials()), // disable TLS
103+
grpc.WithTransportCredentials(insecure.NewCredentials()),
105104
),
106105
)
107106
_, err := r.mgr.NewConfiguration(qspec{}, gorums.WithNodeMap(nodeMap))
@@ -123,10 +122,9 @@ func TestGrpcDial(t *testing.T) {
123122
t.Fatal(err)
124123
}
125124
for _, replica := range replicas {
126-
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(1000)*time.Millisecond)
125+
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(10000)*time.Millisecond)
127126
defer cancel()
128127
replica.conn, err = grpc.DialContext(ctx, replica.address,
129-
grpc.WithBlock(),
130128
grpc.WithTransportCredentials(insecure.NewCredentials()),
131129
)
132130
if err != nil {

0 commit comments

Comments
 (0)