-
Notifications
You must be signed in to change notification settings - Fork 78
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
fix MySQL panic test #996
fix MySQL panic test #996
Conversation
[CHATOPS:HELP] ChatOps commands.
|
internal/errors/mysql.go
Outdated
@@ -50,6 +50,11 @@ var ( | |||
ErrRequiredMemberNotFilled = func(member string) error { | |||
return Wrapf(NewErrMySQLInvalidArgumentIdentity(), "error required member not filled (member: %s)", member) | |||
} | |||
|
|||
// ErrMySQLSessionNil represents a function to generate an error that the MySQL session is nil. | |||
ErrMySQLSessionNil = func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this case you shouldn't use functional type for error, but if you add additional information such as below it's better
db string
host string
port int
user string
pass string
name string
charset string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpango so, for example, should I implement the below code instead of this?
if m.session == nil {
return errors.Errorf("session is nil, { db: %s, host: %s, port: %d, user: %s, pass: %s, name: %s, charset: %s", m.db, m.host, m.port, m.user, m.pass, m.name, m.charset)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrMySQLSessionNil = func() error { | |
ErrMySQLSessionNil = func(db, host, user, name, charset string, port int) error { | |
return errors.Errorf("session is nil, { db: %s, host: %s, port: %d, user: %s, name: %s, charset: %s", db, host, port, user, name, charset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you can print them on debug log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think debug log is easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpango thx for the review, I updated the code 🙏
Codecov Report
@@ Coverage Diff @@
## master #996 +/- ##
==========================================
+ Coverage 14.25% 14.37% +0.12%
==========================================
Files 494 494
Lines 28294 28336 +42
==========================================
+ Hits 4033 4073 +40
- Misses 24012 24013 +1
- Partials 249 250 +1
Continue to review full report at Codecov.
|
/rebase |
[REBASE] Rebase triggered by vankichi for branch: test/internal/fix-mysql-paniced-test |
2550884
to
ac6ee4e
Compare
[FORMAT] Updating license headers and formatting go codes triggered by vankichi. |
missing session validation in |
please also add |
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/fix-mysql-paniced-test |
1fe0da9
to
2e13626
Compare
[FORMAT] Updating license headers and formatting go codes triggered by kevindiu. |
/rebase |
[REBASE] Rebase triggered by vankichi for branch: test/internal/fix-mysql-paniced-test |
/rebase |
[REBASE] Rebase triggered by vankichi for branch: test/internal/fix-mysql-paniced-test |
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
Signed-off-by: vankichi <[email protected]>
a84417f
to
6473f03
Compare
[FORMAT] Updating license headers and formatting go codes triggered by vankichi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you 🙇
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix the panic error of MySQL unit test.
Description:
I researched the panic error during the MySQL unit test.
This error may be caused by
nil
pointer of the session which is one of the MySQL client struct values.My change is following:
session
.ErrMySQLSessionNil
I need the authors' review.
Related Issue:
How Has This Been Tested?:
Environment:
Types of changes:
Changes to Core Features:
Checklist: