Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: fix err check #22986

Merged
merged 7 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmd/ddltest/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ type TestDDLSuite struct {
}

func (s *TestDDLSuite) SetUpSuite(c *C) {
logutil.InitLogger(&logutil.LogConfig{Config: zaplog.Config{Level: *logLevel}})
err := logutil.InitLogger(&logutil.LogConfig{Config: zaplog.Config{Level: *logLevel}})
c.Assert(err, IsNil)

s.quit = make(chan struct{})

var err error
s.store, err = store.New(fmt.Sprintf("tikv://%s%s", *etcd, *tikvPath))
c.Assert(err, IsNil)

Expand Down Expand Up @@ -304,7 +304,10 @@ func (s *TestDDLSuite) startServer(i int, fp *os.File) (*server, error) {
}
log.Warnf("ping addr %v failed, retry count %d err %v", addr, i, err)

db.Close()
err = db.Close()
if err != nil {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can print the log and break it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
time.Sleep(sleepTime)
sleepTime += sleepTime
}
Expand Down
8 changes: 6 additions & 2 deletions cmd/ddltest/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func (s *TestDDLSuite) checkAddIndex(c *C, indexInfo *model.IndexInfo) {
txn, err := ctx.Txn(false)
c.Assert(err, IsNil)
defer func() {
txn.Rollback()
err = txn.Rollback()
c.Assert(err, IsNil)
}()

it, err := idx.SeekFirst(txn)
Expand Down Expand Up @@ -103,7 +104,10 @@ func (s *TestDDLSuite) checkDropIndex(c *C, indexInfo *model.IndexInfo) {
c.Assert(err, IsNil)
txn, err := ctx.Txn(false)
c.Assert(err, IsNil)
defer txn.Rollback()
defer func(){
err := txn.Rollback()
c.Assert(err, IsNil)
}()

it, err := idx.SeekFirst(txn)
c.Assert(err, IsNil)
Expand Down