Skip to content

Commit

Permalink
Remove cache expiry test and hooks, didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson committed May 29, 2024
1 parent 45f9ad7 commit a23b629
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions das/dasRpcServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ type batch struct {
}

const (
maxPendingBatches = 10
maxPendingBatches = 10
batchBuildingExpiry = 1 * time.Minute
)

// exposed globals for test control
// exposed global for test control
var (
batchBuildingExpiry = 1 * time.Minute
legacyDASStoreAPIOnly = false
)

Expand Down
23 changes: 7 additions & 16 deletions das/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func blsPubToBase64(pubkey *blsSignatures.PublicKey) string {

type sleepOnIterationFn func(i int)

Check failure on line 31 in das/rpc_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

type `sleepOnIterationFn` is unused (unused)

Check failure on line 31 in das/rpc_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

type `sleepOnIterationFn` is unused (unused)

Check failure on line 31 in das/rpc_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (stylus)

type `sleepOnIterationFn` is unused (unused)

Check failure on line 31 in das/rpc_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (long)

type `sleepOnIterationFn` is unused (unused)

Check failure on line 31 in das/rpc_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

type `sleepOnIterationFn` is unused (unused)

func testRpcImpl(t *testing.T, size, times int, concurrent bool, sleepOnIteration sleepOnIterationFn) {
func testRpcImpl(t *testing.T, size, times int, concurrent bool) {
// enableLogging()

ctx := context.Background()
Expand Down Expand Up @@ -125,7 +125,6 @@ func testRpcImpl(t *testing.T, size, times int, concurrent bool, sleepOnIteratio
} else {
runStore()
}
sleepOnIteration(i)
}

wg.Wait()
Expand All @@ -134,29 +133,21 @@ func testRpcImpl(t *testing.T, size, times int, concurrent bool, sleepOnIteratio
const chunkSize = 512 * 1024

func TestRPCStore(t *testing.T) {
dontSleep := func(_ int) {}

for _, tc := range []struct {
desc string
totalSize, times int
concurrent bool
sleepOnIteration sleepOnIterationFn
leagcyAPIOnly bool
}{
{desc: "small store", totalSize: 100, times: 1, concurrent: false, sleepOnIteration: dontSleep},
{desc: "chunked store - last chunk full", totalSize: chunkSize * 20, times: 10, concurrent: true, sleepOnIteration: dontSleep},
{desc: "chunked store - last chunk not full", totalSize: chunkSize*31 + 123, times: 10, concurrent: true, sleepOnIteration: dontSleep},
{desc: "chunked store - overflow cache - sequential", totalSize: chunkSize * 3, times: 15, concurrent: false, sleepOnIteration: dontSleep},
{desc: "chunked store - wait for cache clear", totalSize: chunkSize * 3, times: 15, concurrent: true, sleepOnIteration: func(i int) {
if i == 9 {
time.Sleep(time.Second * 6)
}
}},
{desc: "new client falls back to old api for old server", totalSize: (5*1024*1024)/2 - len(sendChunkJSONBoilerplate) - 100 /* geth counts headers too */, times: 5, concurrent: true, sleepOnIteration: dontSleep, leagcyAPIOnly: true},
{desc: "small store", totalSize: 100, times: 1, concurrent: false},
{desc: "chunked store - last chunk full", totalSize: chunkSize * 20, times: 10, concurrent: true},
{desc: "chunked store - last chunk not full", totalSize: chunkSize*31 + 123, times: 10, concurrent: true},
{desc: "chunked store - overflow cache - sequential", totalSize: chunkSize * 3, times: 15, concurrent: false},
{desc: "new client falls back to old api for old server", totalSize: (5*1024*1024)/2 - len(sendChunkJSONBoilerplate) - 100 /* geth counts headers too */, times: 5, concurrent: true, leagcyAPIOnly: true},
} {
t.Run(tc.desc, func(t *testing.T) {
legacyDASStoreAPIOnly = tc.leagcyAPIOnly
testRpcImpl(t, tc.totalSize, tc.times, tc.concurrent, tc.sleepOnIteration)
testRpcImpl(t, tc.totalSize, tc.times, tc.concurrent)
})
}
}

0 comments on commit a23b629

Please sign in to comment.