aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/database_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-05-27 08:07:03 +0800
committerobscuren <geffobscura@gmail.com>2015-05-27 08:07:03 +0800
commit70867904a0255bd044851585a9ad2dc34391ced2 (patch)
tree9c5dfc6a9b8944c37f874a81cc9f8fd3d697ad4e /p2p/discover/database_test.go
parentceea1a7051ddc7d2660117204aeb3392b7cf8314 (diff)
parent2c532a7255919bc09e01cca6866bfc15682509a3 (diff)
downloadgo-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar.gz
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar.bz2
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar.lz
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar.xz
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.tar.zst
go-tangerine-70867904a0255bd044851585a9ad2dc34391ced2.zip
Merge branch 'release/0.9.25'v0.9.25
Diffstat (limited to 'p2p/discover/database_test.go')
-rw-r--r--p2p/discover/database_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/p2p/discover/database_test.go b/p2p/discover/database_test.go
index 88f5d2155..4fce164ca 100644
--- a/p2p/discover/database_test.go
+++ b/p2p/discover/database_test.go
@@ -93,6 +93,7 @@ func TestNodeDBFetchStore(t *testing.T) {
30303,
)
inst := time.Now()
+ num := 314
db, _ := newNodeDB("", Version, NodeID{})
defer db.close()
@@ -117,6 +118,16 @@ func TestNodeDBFetchStore(t *testing.T) {
if stored := db.lastPong(node.ID); stored.Unix() != inst.Unix() {
t.Errorf("pong: value mismatch: have %v, want %v", stored, inst)
}
+ // Check fetch/store operations on a node findnode-failure object
+ if stored := db.findFails(node.ID); stored != 0 {
+ t.Errorf("find-node fails: non-existing object: %v", stored)
+ }
+ if err := db.updateFindFails(node.ID, num); err != nil {
+ t.Errorf("find-node fails: failed to update: %v", err)
+ }
+ if stored := db.findFails(node.ID); stored != num {
+ t.Errorf("find-node fails: value mismatch: have %v, want %v", stored, num)
+ }
// Check fetch/store operations on an actual node object
if stored := db.node(node.ID); stored != nil {
t.Errorf("node: non-existing object: %v", stored)