-
Notifications
You must be signed in to change notification settings - Fork 60
box: added logic for working with Tarantool schema #446
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
base: master
Are you sure you want to change the base?
Conversation
5d1b376
to
b869130
Compare
Is this PR ready for review? If so, please assign two reviewers from the team (usually one of them is the repository maintainer, but it is not necessary). |
The dot is missed.
->
|
It looks a bit ugly for me. For example, I don’t understand why the timestamp might be useful to us. I like the co-authored-by label in the commit message instead:
But up to you. |
Implemented the `box.Schema()` method that returns a `Schema` object for schema-related operations. Co-authored-by: maksim.konovalov <[email protected]>
b869130
to
fc70848
Compare
fc70848
to
afcd25f
Compare
* preemptive checking for empty connection * hide constructors for schema and etc * redo (minify) API for box.session.su (simplify it) * added mock tests to check API
afcd25f
to
fab4d84
Compare
if conn == nil { | ||
// Check if the provided Tarantool connection is nil, and if it is, panic with an error | ||
// message. panic early helps to catch and fix nil pointer issues in the code. | ||
panic("tarantool connection cannot be nil") | ||
} |
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 don't see the point. Whether panic happens here or somewhere else on nil dereference, it will happen anyway and it can be easily identified.
if conn == nil { | |
// Check if the provided Tarantool connection is nil, and if it is, panic with an error | |
// message. panic early helps to catch and fix nil pointer issues in the code. | |
panic("tarantool connection cannot be nil") | |
} |
func TestMocked(t *testing.T) { | ||
t.Run("Box.Info", func(t *testing.T) { |
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.
Let's just write three different tests. Motivation: everywhere in the connector, separate test cases are used, instead of the subtests.
func TestMocked(t *testing.T) { | |
t.Run("Box.Info", func(t *testing.T) { | |
func TestMocked_BoxInfo(t *testing.T) { |
|
||
func Ptr[T any](val T) *T { | ||
return &val | ||
} |
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.
Please, add a comment for the public function and move it to test_helpers/utils.go .
@@ -0,0 +1,28 @@ | |||
package box |
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.
Please, test only the public API.
package box | |
package box_test |
@@ -0,0 +1,65 @@ | |||
package box |
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.
package box | |
package box_test |
@@ -0,0 +1,210 @@ | |||
package box |
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.
package box | |
package box_test |
@@ -0,0 +1,39 @@ | |||
package box |
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.
package box | |
package box_test |
Implemented the
box.Schema()
method that returns aSchema
object for schema-related operations.Co-authored-by: maksim.konovalov [email protected]