Ensure that a database can perform multiple large appends safely.
(t *testing.T)
| 205 | |
| 206 | // Ensure that a database can perform multiple large appends safely. |
| 207 | func TestDB_Put_VeryLarge(t *testing.T) { |
| 208 | if testing.Short() { |
| 209 | t.Skip("skipping test in short mode.") |
| 210 | } |
| 211 | |
| 212 | n, batchN := 400000, 200000 |
| 213 | ksize, vsize := 8, 500 |
| 214 | |
| 215 | db := btesting.MustCreateDB(t) |
| 216 | |
| 217 | for i := 0; i < n; i += batchN { |
| 218 | if err := db.Update(func(tx *bolt.Tx) error { |
| 219 | b, err := tx.CreateBucketIfNotExists([]byte("widgets")) |
| 220 | if err != nil { |
| 221 | t.Fatal(err) |
| 222 | } |
| 223 | for j := 0; j < batchN; j++ { |
| 224 | k, v := make([]byte, ksize), make([]byte, vsize) |
| 225 | binary.BigEndian.PutUint32(k, uint32(i+j)) |
| 226 | if err := b.Put(k, v); err != nil { |
| 227 | t.Fatal(err) |
| 228 | } |
| 229 | } |
| 230 | return nil |
| 231 | }); err != nil { |
| 232 | t.Fatal(err) |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | // Ensure that a setting a value on a key with a bucket value returns an error. |
| 238 | func TestBucket_Put_IncompatibleValue(t *testing.T) { |
nothing calls this directly
no test coverage detected