make a few tests perform operations in two directions instead of one
Jeromy committed
Sep 22, 2014 at 22:34 UTC
722878698166a49934c3e67b5d980ec12918fca1
1 file changed
+16
-1
routing/dht/dht_test.go
+16
-1
@@ -115,11 +115,17 @@ func TestPing(t *testing.T) {
115
}
116
117
//Test that we can ping the node
118
- ctx, _ := context.WithTimeout(context.Background(), 2*time.Millisecond)
118
+ ctx, _ := context.WithTimeout(context.Background(), 5*time.Millisecond)
119
err = dhtA.Ping(ctx, peerB)
120
if err != nil {
121
t.Fatal(err)
122
}
123
+
124
+ ctx, _ = context.WithTimeout(context.Background(), 5*time.Millisecond)
125
+ err = dhtB.Ping(ctx, peerA)
126
+ if err != nil {
127
+ t.Fatal(err)
128
+ }
129
}
130
131
func TestValueGetSet(t *testing.T) {
@@ -164,6 +170,15 @@ func TestValueGetSet(t *testing.T) {
170
t.Fatalf("Expected 'world' got '%s'", string(val))
171
}
172
173
+ ctxT, _ = context.WithTimeout(context.Background(), time.Second*2)
174
+ val, err = dhtB.GetValue(ctxT, "hello")
175
+ if err != nil {
176
+ t.Fatal(err)
177
+ }
178
+
179
+ if string(val) != "world" {
180
+ t.Fatalf("Expected 'world' got '%s'", string(val))
181
+ }
182
}
183
184
func TestProvides(t *testing.T) {