MCPcopy Index your code
hub / github.com/coder/coder / TestReadModifyUpdate_HardError

Function TestReadModifyUpdate_HardError

coderd/database/tx_test.go:52–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestReadModifyUpdate_HardError(t *testing.T) {
53 t.Parallel()
54
55 mDB := dbmock.NewMockStore(gomock.NewController(t))
56
57 mDB.EXPECT().
58 InTx(gomock.Any(), &database.TxOptions{Isolation: sql.LevelRepeatableRead}).
59 Times(1).
60 Return(xerrors.New("a bad thing happened"))
61
62 err := database.ReadModifyUpdate(mDB, func(tx database.Store) error {
63 return nil
64 })
65 require.ErrorContains(t, err, "a bad thing happened")
66}
67
68func TestReadModifyUpdate_TooManyRetries(t *testing.T) {
69 t.Parallel()

Callers

nothing calls this directly

Calls 5

EXPECTMethod · 0.95
NewMockStoreFunction · 0.92
ReadModifyUpdateFunction · 0.92
InTxMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected