diff options
Diffstat (limited to 'src/gnunet/service/store/store_dht_test.go')
-rw-r--r-- | src/gnunet/service/store/store_dht_test.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gnunet/service/store/store_dht_test.go b/src/gnunet/service/store/store_dht_test.go index 9f80380..5278634 100644 --- a/src/gnunet/service/store/store_dht_test.go +++ b/src/gnunet/service/store/store_dht_test.go | |||
@@ -66,6 +66,8 @@ func TestDHTFilesStore(t *testing.T) { | |||
66 | rf := blocks.NewGenericResultFilter() | 66 | rf := blocks.NewGenericResultFilter() |
67 | 67 | ||
68 | // First round: save blocks | 68 | // First round: save blocks |
69 | btype := enums.BLOCK_TYPE_TEST | ||
70 | expire := util.AbsoluteTimeNever() | ||
69 | for i := 0; i < fsNumBlocks; i++ { | 71 | for i := 0; i < fsNumBlocks; i++ { |
70 | // generate random block | 72 | // generate random block |
71 | size := 1024 + rand.Intn(62000) //nolint:gosec // good enough for testing | 73 | size := 1024 + rand.Intn(62000) //nolint:gosec // good enough for testing |
@@ -73,10 +75,13 @@ func TestDHTFilesStore(t *testing.T) { | |||
73 | if _, err = rand.Read(buf); err != nil { //nolint:gosec // good enough for testing | 75 | if _, err = rand.Read(buf); err != nil { //nolint:gosec // good enough for testing |
74 | t.Fatal(err) | 76 | t.Fatal(err) |
75 | } | 77 | } |
76 | blk := blocks.NewGenericBlock(buf) | 78 | var blk blocks.Block |
79 | if blk, err = blocks.NewBlock(btype, expire, buf); err != nil { | ||
80 | t.Fatal(err) | ||
81 | } | ||
77 | // generate associated key | 82 | // generate associated key |
78 | k := crypto.Hash(buf) | 83 | k := crypto.Hash(buf) |
79 | key := blocks.NewGenericQuery(k, enums.BLOCK_TYPE_ANY, 0) | 84 | key := blocks.NewGenericQuery(k, enums.BLOCK_TYPE_TEST, 0) |
80 | 85 | ||
81 | // store entry | 86 | // store entry |
82 | val := &DHTEntry{ | 87 | val := &DHTEntry{ |
@@ -105,9 +110,9 @@ func TestDHTFilesStore(t *testing.T) { | |||
105 | k := crypto.Hash(buf) | 110 | k := crypto.Hash(buf) |
106 | 111 | ||
107 | // do the keys match? | 112 | // do the keys match? |
108 | if !k.Equals(key.Key()) { | 113 | if !k.Equal(key.Key()) { |
109 | t.Log(hex.EncodeToString(k.Bits)) | 114 | t.Log(hex.EncodeToString(k.Data)) |
110 | t.Log(hex.EncodeToString(key.Key().Bits)) | 115 | t.Log(hex.EncodeToString(key.Key().Data)) |
111 | t.Fatal("key/value mismatch") | 116 | t.Fatal("key/value mismatch") |
112 | } | 117 | } |
113 | } | 118 | } |