aboutsummaryrefslogtreecommitdiffstats
path: root/blockpool/config_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-01 03:52:57 +0800
committerobscuren <geffobscura@gmail.com>2015-03-01 03:52:57 +0800
commit73c52d1677ba526385f1b223ef48f3a26091fe00 (patch)
treeb7414552192d8e7520a2df8353677a5f19231866 /blockpool/config_test.go
parentae45a39dc1cddac885090872cefc6799b4a4c1d9 (diff)
parentc18ea4de147cb81bf5563a5727172d4103658b92 (diff)
downloaddexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.gz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.bz2
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.lz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.xz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.zst
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.zip
Merge branch 'ethersphere-blockpool2' into poc-9
Diffstat (limited to 'blockpool/config_test.go')
-rw-r--r--blockpool/config_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/blockpool/config_test.go b/blockpool/config_test.go
new file mode 100644
index 000000000..c06649024
--- /dev/null
+++ b/blockpool/config_test.go
@@ -0,0 +1,40 @@
+package blockpool
+
+import (
+ "testing"
+ "time"
+
+ "github.com/ethereum/go-ethereum/blockpool/test"
+)
+
+func TestBlockPoolConfig(t *testing.T) {
+ test.LogInit()
+ blockPool := &BlockPool{Config: &Config{}}
+ blockPool.Start()
+ c := blockPool.Config
+ test.CheckInt("BlockHashesBatchSize", c.BlockHashesBatchSize, blockHashesBatchSize, t)
+ test.CheckInt("BlockBatchSize", c.BlockBatchSize, blockBatchSize, t)
+ test.CheckInt("BlocksRequestRepetition", c.BlocksRequestRepetition, blocksRequestRepetition, t)
+ test.CheckInt("BlocksRequestMaxIdleRounds", c.BlocksRequestMaxIdleRounds, blocksRequestMaxIdleRounds, t)
+ test.CheckDuration("BlockHashesRequestInterval", c.BlockHashesRequestInterval, blockHashesRequestInterval, t)
+ test.CheckDuration("BlocksRequestInterval", c.BlocksRequestInterval, blocksRequestInterval, t)
+ test.CheckDuration("BlockHashesTimeout", c.BlockHashesTimeout, blockHashesTimeout, t)
+ test.CheckDuration("BlocksTimeout", c.BlocksTimeout, blocksTimeout, t)
+}
+
+func TestBlockPoolOverrideConfig(t *testing.T) {
+ test.LogInit()
+ blockPool := &BlockPool{Config: &Config{}}
+ c := &Config{128, 32, 1, 0, 300 * time.Millisecond, 100 * time.Millisecond, 90 * time.Second, 0}
+
+ blockPool.Config = c
+ blockPool.Start()
+ test.CheckInt("BlockHashesBatchSize", c.BlockHashesBatchSize, 128, t)
+ test.CheckInt("BlockBatchSize", c.BlockBatchSize, 32, t)
+ test.CheckInt("BlocksRequestRepetition", c.BlocksRequestRepetition, blocksRequestRepetition, t)
+ test.CheckInt("BlocksRequestMaxIdleRounds", c.BlocksRequestMaxIdleRounds, blocksRequestMaxIdleRounds, t)
+ test.CheckDuration("BlockHashesRequestInterval", c.BlockHashesRequestInterval, 300*time.Millisecond, t)
+ test.CheckDuration("BlocksRequestInterval", c.BlocksRequestInterval, 100*time.Millisecond, t)
+ test.CheckDuration("BlockHashesTimeout", c.BlockHashesTimeout, 90*time.Second, t)
+ test.CheckDuration("BlocksTimeout", c.BlocksTimeout, blocksTimeout, t)
+}