MCPcopy
hub / github.com/etcd-io/bbolt / TestDB_Update_Closed

Function TestDB_Update_Closed

db_test.go:1005–1015  ·  view source on GitHub ↗

Ensure a closed database returns an error while running a transaction block

(t *testing.T)

Source from the content-addressed store, hash-verified

1003
1004// Ensure a closed database returns an error while running a transaction block
1005func TestDB_Update_Closed(t *testing.T) {
1006 var db bolt.DB
1007 if err := db.Update(func(tx *bolt.Tx) error {
1008 if _, err := tx.CreateBucket([]byte("widgets")); err != nil {
1009 t.Fatal(err)
1010 }
1011 return nil
1012 }); err != berrors.ErrDatabaseNotOpen {
1013 t.Fatalf("unexpected error: %s", err)
1014 }
1015}
1016
1017// Ensure a panic occurs while trying to commit a managed transaction.
1018func TestDB_Update_ManualCommit(t *testing.T) {

Callers

nothing calls this directly

Calls 4

UpdateMethod · 0.95
FatalMethod · 0.65
FatalfMethod · 0.65
CreateBucketMethod · 0.45

Tested by

no test coverage detected