1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 17:22:21 +08:00

switch DHT entries over to be records, test currently fail

This commit is contained in:
Jeromy
2014-11-09 23:45:16 -08:00
committed by Juan Batiz-Benet
parent e290b54d9e
commit 33985c530e
9 changed files with 231 additions and 31 deletions

View File

@ -124,10 +124,10 @@ func TestGetFailures(t *testing.T) {
fs := &fauxSender{}
peerstore := peer.NewPeerstore()
local := peer.WithIDString("test_peer")
local := makePeer(nil)
d := NewDHT(ctx, local, peerstore, fn, fs, ds.NewMapDatastore())
other := peer.WithIDString("other_peer")
other := makePeer(nil)
d.Update(other)
// This one should time out
@ -173,10 +173,14 @@ func TestGetFailures(t *testing.T) {
// Now we test this DHT's handleGetValue failure
typ := pb.Message_GET_VALUE
str := "hello"
rec, err := d.makePutRecord(u.Key(str), []byte("blah"))
if err != nil {
t.Fatal(err)
}
req := pb.Message{
Type: &typ,
Key: &str,
Value: []byte{0},
Type: &typ,
Key: &str,
Record: rec,
}
// u.POut("handleGetValue Test\n")
@ -192,10 +196,10 @@ func TestGetFailures(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if pmes.GetValue() != nil {
if pmes.GetRecord() != nil {
t.Fatal("shouldnt have value")
}
if pmes.GetCloserPeers() != nil {
if len(pmes.GetCloserPeers()) > 0 {
t.Fatal("shouldnt have closer peers")
}
if pmes.GetProviderPeers() != nil {
@ -221,7 +225,7 @@ func TestNotFound(t *testing.T) {
fn := &fauxNet{}
fs := &fauxSender{}
local := peer.WithIDString("test_peer")
local := makePeer(nil)
peerstore := peer.NewPeerstore()
peerstore.Add(local)
@ -287,7 +291,7 @@ func TestLessThanKResponses(t *testing.T) {
u.Debug = false
fn := &fauxNet{}
fs := &fauxSender{}
local := peer.WithIDString("test_peer")
local := makePeer(nil)
peerstore := peer.NewPeerstore()
peerstore.Add(local)