swarm/chunk: move chunk related declarations to chunk package (#19170)
This commit is contained in:
committed by
Anton Evangelatov
parent
b7e0dec6bd
commit
f0233948d2
@ -29,7 +29,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
ch "github.com/ethereum/go-ethereum/swarm/chunk"
|
||||
"github.com/ethereum/go-ethereum/swarm/chunk"
|
||||
)
|
||||
|
||||
var sourcePeerID = enode.HexID("99d8594b52298567d2ca3f4c441a5ba0140ee9245e26460d01102a52773c73b9")
|
||||
@ -114,7 +114,7 @@ func mustNewNetStoreWithFetcher(t *testing.T) (*NetStore, *mockNetFetcher) {
|
||||
func TestNetStoreGetAndPut(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
@ -174,7 +174,7 @@ func TestNetStoreGetAndPut(t *testing.T) {
|
||||
func TestNetStoreGetAfterPut(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
@ -209,7 +209,7 @@ func TestNetStoreGetAfterPut(t *testing.T) {
|
||||
func TestNetStoreGetTimeout(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
@ -261,7 +261,7 @@ func TestNetStoreGetTimeout(t *testing.T) {
|
||||
func TestNetStoreGetCancel(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
|
||||
@ -313,7 +313,7 @@ func TestNetStoreGetCancel(t *testing.T) {
|
||||
func TestNetStoreMultipleGetAndPut(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
@ -387,7 +387,7 @@ func TestNetStoreMultipleGetAndPut(t *testing.T) {
|
||||
func TestNetStoreFetchFuncTimeout(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
|
||||
defer cancel()
|
||||
@ -426,7 +426,7 @@ func TestNetStoreFetchFuncTimeout(t *testing.T) {
|
||||
func TestNetStoreFetchFuncAfterPut(t *testing.T) {
|
||||
netStore := mustNewNetStore(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
@ -453,7 +453,7 @@ func TestNetStoreFetchFuncAfterPut(t *testing.T) {
|
||||
func TestNetStoreGetCallsRequest(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx := context.WithValue(context.Background(), "hopcount", uint8(5))
|
||||
ctx, cancel := context.WithTimeout(ctx, 200*time.Millisecond)
|
||||
@ -481,7 +481,7 @@ func TestNetStoreGetCallsRequest(t *testing.T) {
|
||||
func TestNetStoreGetCallsOffer(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
// If a source peer is added to the context, NetStore will handle it as an offer
|
||||
ctx := context.WithValue(context.Background(), "source", sourcePeerID.String())
|
||||
@ -567,7 +567,7 @@ func TestNetStoreFetcherCountPeers(t *testing.T) {
|
||||
func TestNetStoreFetchFuncCalledMultipleTimes(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
@ -632,7 +632,7 @@ func TestNetStoreFetchFuncCalledMultipleTimes(t *testing.T) {
|
||||
func TestNetStoreFetcherLifeCycleWithTimeout(t *testing.T) {
|
||||
netStore, fetcher := mustNewNetStoreWithFetcher(t)
|
||||
|
||||
chunk := GenerateRandomChunk(ch.DefaultSize)
|
||||
chunk := GenerateRandomChunk(chunk.DefaultSize)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
|
Reference in New Issue
Block a user