Skip to content

Commit 0fe9a37

Browse files
authored
swarm, swarm/storage: lower constants for faster tests (#17876)
* swarm/storage: lower constants for faster tests * swarm: reduce test size for TestLocalStoreAndRetrieve * swarm: reduce nodes for dec_inc_node_count
1 parent d5c7a60 commit 0fe9a37

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

swarm/network_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ func TestSwarmNetwork(t *testing.T) {
151151
name: "dec_inc_node_count",
152152
steps: []testSwarmNetworkStep{
153153
{
154-
nodeCount: 5,
154+
nodeCount: 3,
155155
},
156156
{
157-
nodeCount: 3,
157+
nodeCount: 1,
158158
},
159159
{
160-
nodeCount: 10,
160+
nodeCount: 5,
161161
},
162162
},
163163
options: &testSwarmNetworkOptions{

swarm/storage/chunker_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ func TestDataAppend(t *testing.T) {
232232
func TestRandomData(t *testing.T) {
233233
// This test can validate files up to a relatively short length, as tree chunker slows down drastically.
234234
// Validation of longer files is done by TestLocalStoreAndRetrieve in swarm package.
235-
sizes := []int{1, 60, 83, 179, 253, 1024, 4095, 4096, 4097, 8191, 8192, 8193, 12287, 12288, 12289, 524288, 524288 + 1, 524288 + 4097, 7 * 524288, 7*524288 + 1, 7*524288 + 4097}
235+
//sizes := []int{1, 60, 83, 179, 253, 1024, 4095, 4096, 4097, 8191, 8192, 8193, 12287, 12288, 12289, 524288, 524288 + 1, 524288 + 4097, 7 * 524288, 7*524288 + 1, 7*524288 + 4097}
236+
sizes := []int{1, 60, 83, 179, 253, 1024, 4095, 4097, 8191, 8192, 12288, 12289, 524288}
236237
tester := &chunkerTester{t: t}
237238

238239
for _, s := range sizes {

swarm/storage/filestore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"testing"
2626
)
2727

28-
const testDataSize = 0x1000000
28+
const testDataSize = 0x0001000
2929

3030
func TestFileStorerandom(t *testing.T) {
3131
testFileStoreRandom(false, t)

swarm/storage/ldbstore_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ func TestDbStoreCorrect_1(t *testing.T) {
111111
testDbStoreCorrect(1, 4096, false, t)
112112
}
113113

114-
func TestDbStoreRandom_5k(t *testing.T) {
115-
testDbStoreRandom(5000, 0, false, t)
114+
func TestDbStoreRandom_1k(t *testing.T) {
115+
testDbStoreRandom(1000, 0, false, t)
116116
}
117117

118-
func TestDbStoreCorrect_5k(t *testing.T) {
119-
testDbStoreCorrect(5000, 4096, false, t)
118+
func TestDbStoreCorrect_1k(t *testing.T) {
119+
testDbStoreCorrect(1000, 4096, false, t)
120120
}
121121

122122
func TestMockDbStoreRandom_1(t *testing.T) {
@@ -127,12 +127,12 @@ func TestMockDbStoreCorrect_1(t *testing.T) {
127127
testDbStoreCorrect(1, 4096, true, t)
128128
}
129129

130-
func TestMockDbStoreRandom_5k(t *testing.T) {
131-
testDbStoreRandom(5000, 0, true, t)
130+
func TestMockDbStoreRandom_1k(t *testing.T) {
131+
testDbStoreRandom(1000, 0, true, t)
132132
}
133133

134-
func TestMockDbStoreCorrect_5k(t *testing.T) {
135-
testDbStoreCorrect(5000, 4096, true, t)
134+
func TestMockDbStoreCorrect_1k(t *testing.T) {
135+
testDbStoreCorrect(1000, 4096, true, t)
136136
}
137137

138138
func testDbStoreNotFound(t *testing.T, mock bool) {

swarm/storage/memstore_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,15 @@ func TestMemStoreAndLDBStore(t *testing.T) {
111111
chunkSize: 4096,
112112
},
113113
{
114-
n: 201,
114+
n: 101,
115115
chunkSize: 4096,
116116
},
117117
{
118118
n: 501,
119119
chunkSize: 4096,
120120
},
121121
{
122-
n: 3100,
123-
chunkSize: 4096,
124-
},
125-
{
126-
n: 100,
122+
n: 1100,
127123
chunkSize: 4096,
128124
},
129125
}

swarm/swarm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ func TestLocalStoreAndRetrieve(t *testing.T) {
316316
}
317317

318318
// by default, test only the lonely chunk cases
319-
sizes := []int{1, 60, 4097, 524288 + 1, 7*524288 + 1, 128*524288 + 1}
319+
sizes := []int{1, 60, 4097, 524288 + 1, 7*524288 + 1}
320320

321321
if *longrunning {
322322
// test broader set of cases if -longruning flag is set
323-
sizes = append(sizes, 83, 179, 253, 1024, 4095, 4096, 8191, 8192, 8193, 12287, 12288, 12289, 123456, 2345678, 67298391, 524288, 524288+4096, 524288+4097, 7*524288, 7*524288+4096, 7*524288+4097, 128*524288, 128*524288+4096, 128*524288+4097, 816778334)
323+
sizes = append(sizes, 83, 179, 253, 1024, 4095, 4096, 8191, 8192, 8193, 12287, 12288, 12289, 123456, 2345678, 67298391, 524288, 524288+4096, 524288+4097, 7*524288, 7*524288+4096, 7*524288+4097, 128*524288+1, 128*524288, 128*524288+4096, 128*524288+4097, 816778334)
324324
}
325325
for _, n := range sizes {
326326
testLocalStoreAndRetrieve(t, swarm, n, true)

0 commit comments

Comments
 (0)