Skip to content

Commit 174d2f8

Browse files
test: improve test coverage for pkg/datasource/sql/undo (#971)
* test: improve test coverage for pkg/datasource/sql/undo * fix: correct spelling errors * style: format code with go fmt for undo package * Correcting spelling errors * fix: skip mysql undo manager tests requiring database connections * fix: resolve staticcheck SA4006 unused variable warnings Move manager variable creation after t.Skip() calls in MySQL undo tests to prevent unused variable warnings from golangci-lint staticcheck. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Conflict handling * reslove conficts * test: improve test coverage for pkg/datasource/sql/undo package * style: apply gofmt fixes * improve test coverage for pkg/datasource/sql/undo --------- Co-authored-by: Claude <[email protected]>
1 parent 34dfa82 commit 174d2f8

26 files changed

+4002
-1727
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ require (
8282
github.com/prometheus/procfs v0.7.3 // indirect
8383
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
8484
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
85+
github.com/stretchr/objx v0.5.0 // indirect
8586
github.com/tklauser/go-sysconf v0.3.10 // indirect
8687
github.com/tklauser/numcpus v0.4.0 // indirect
8788
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J
715715
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
716716
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
717717
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
718+
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
718719
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
719720
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
720721
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

pkg/datasource/sql/undo/base/undo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (m *BaseUndoLogManager) FlushUndoLog(tranCtx *types.TransactionContext, con
238238
XID: tranCtx.XID,
239239
Context: undoLogContent,
240240
RollbackInfo: rollbackInfo,
241-
LogStatus: undo.UndoLogStatueNormnal,
241+
LogStatus: undo.UndoLogStatusNormal,
242242
}, conn)
243243
}
244244

@@ -368,13 +368,13 @@ func (m *BaseUndoLogManager) Undo(ctx context.Context, dbType types.DBType, xid
368368
log.Errorf("[Undo] delete undo fail, err: %v", err)
369369
return err
370370
}
371-
log.Infof("xid %v branch %v, undo_log deleted with %v", xid, branchID, undo.UndoLogStatueGlobalFinished)
371+
log.Infof("xid %v branch %v, undo_log deleted with %v", xid, branchID, undo.UndoLogStatusGlobalFinished)
372372
} else {
373373
if err = m.insertUndoLogWithGlobalFinished(ctx, xid, uint64(branchID), conn); err != nil {
374374
log.Errorf("[Undo] insert undo with global finished fail, err: %v", err)
375375
return err
376376
}
377-
log.Infof("xid %v branch %v, undo_log added with %v", xid, branchID, undo.UndoLogStatueGlobalFinished)
377+
log.Infof("xid %v branch %v, undo_log added with %v", xid, branchID, undo.UndoLogStatusGlobalFinished)
378378
}
379379

380380
if err = tx.Commit(); err != nil {

0 commit comments

Comments
 (0)