Test crossing of 16MB (AllocSize) of db size
(t *testing.T)
| 47 | |
| 48 | // Test crossing of 16MB (AllocSize) of db size |
| 49 | func TestMlock_DbCanGrow_Big(t *testing.T) { |
| 50 | if testing.Short() { |
| 51 | t.Skip("skipping test in short mode") |
| 52 | } |
| 53 | |
| 54 | // 32MB |
| 55 | skipOnMemlockLimitBelow(t, 32*1024*1024) |
| 56 | |
| 57 | chunksBefore := 64 |
| 58 | chunksAfter := 64 |
| 59 | |
| 60 | db := btesting.MustCreateDBWithOption(t, &bolt.Options{Mlock: true}) |
| 61 | |
| 62 | for chunk := 0; chunk < chunksBefore; chunk++ { |
| 63 | insertChunk(t, db, chunk) |
| 64 | } |
| 65 | dbSize := fileSize(db.Path()) |
| 66 | |
| 67 | for chunk := 0; chunk < chunksAfter; chunk++ { |
| 68 | insertChunk(t, db, chunksBefore+chunk) |
| 69 | } |
| 70 | newDbSize := fileSize(db.Path()) |
| 71 | |
| 72 | if newDbSize <= dbSize { |
| 73 | t.Errorf("db didn't grow: %v <= %v", newDbSize, dbSize) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func insertChunk(t *testing.T, db *btesting.DB, chunkId int) { |
| 78 | chunkSize := 1024 |
nothing calls this directly
no test coverage detected