Skip to content

Commit

Permalink
fix test ndf
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jan 23, 2025
1 parent a92e0ca commit 22a44d9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions persist/sqlite/volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func TestShrinkVolume(t *testing.T) {
}

func TestMigrateConcurrency(t *testing.T) {
const initialSectors = 256 * 100 // 100GiB
const initialSectors = 256
log := zap.NewNop()
db, err := OpenDatabase(filepath.Join(t.TempDir(), "test.db"), log)
if err != nil {
Expand Down Expand Up @@ -466,9 +466,10 @@ func TestMigrateConcurrency(t *testing.T) {
go func() {
defer wg.Done()
_, _, err := db.MigrateSectors(ctx, v1.ID, 0, func(from, to storage.SectorLocation) error {
time.Sleep(100 * time.Millisecond)
// simulate disk i/o
time.Sleep(50 * time.Millisecond)
return nil
}) // simulate disk i/o
})
if err != nil && !errors.Is(err, context.Canceled) {
panic(err)
}
Expand All @@ -477,7 +478,12 @@ func TestMigrateConcurrency(t *testing.T) {
// fill the second volume
for i := 0; i < initialSectors; i++ {
root := types.Hash256(frand.Entropy256())
if err := db.StoreSector(root, func(_ storage.SectorLocation) error { return nil }); err != nil {
err := db.StoreSector(root, func(_ storage.SectorLocation) error {
// simulate disk i/o
time.Sleep(10 * time.Millisecond)
return nil
})
if err != nil {
t.Fatal(err)
} else if err := db.AddTempSector(root, 100); err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 22a44d9

Please sign in to comment.