Closed DerekBum closed 7 months ago
Updated README and CHANGELOG, added more comments and more tests (I will squash commits at the last step).
Updated everything, returned deleted tests.
The failing ci test is because of
shutdown_test.go:130: Could not check the Tarantool version: fork/exec /home/runner/work/go-tarantool/go-tarantool/bin/tarantool: bad file descriptor
Updated the commits so the changes got separated properly.
Updated the commits so the changes in CHANGELOG.md
, README.md
and doc comments got separated properly.
Updated CHANGELOG
and README
.
Added an ability to mock connections via new
MockRequest
,MockResponse
andMockDoer
structs. Huge rework for the responses was done in the progress, here is list of changes for every commit (3 commits total):First commit creates a new
Response
interface. But still, only oneResponse
implementation exists:ConnResponse
. Custom responses (including mocks) are expected to implement this interface.Create a
Response
interface and its implementationConnResponse
.For the
Future
methodGet
now returns response data. To get the actual response new methodGetResponse
is added.IsPush()
method is added to the response iterator. It returns the information if the current response is aPush
. Right now it does not have a lot of usage, but it will be crucial once we create a separate response for pushesSecond commit creates different implementations of the
Response
interface. Special types of responses are used with special requests.Thus
Response
interface was simplified: some special methods were moved to the corresponding implementations. This means that if a user wants to access this methods, the response should be casted to its actual type.SelectResponse
,ExecuteResponse
,PrepareResponse
,PushResponse
are part of a public API.Pos()
,MetaData()
,SQLInfo()
methods created for them to get specific info.Future
constructors now acceptRequest
as their argument.Future
methodsAppendPush
andSetResponse
accept responseHeader
and data as their arguments.IsPush()
method is used to return the information if the current response is aPushResponse
.PushCode
constant is removed. To get information, if the current response is a push response,IsPush()
method could be used instead.After this patch, operations
Ping
,Select
,Insert
,Replace
,Delete
,Update
,Upsert
,Call
,Call16
,Call17
,Eval
,Execute
of aConnector
return response data instead of an actual responses. After this patch, operationsPing
,Select
,Insert
,Replace
,Delete
,Update
,Upsert
,Call
,Call16
,Call17
,Eval
,Execute
of aPooler
return response data instead of an actual responses.Third commit creates a mock implementations
MockRequest
,MockResponse
andMockDoer
. The last one allows to mock not the fullConnection
, but its part -- a structure, that implements newDoer
interface (aDo
function).Also added missing comments, all the changes are recorded in the
CHANGELOG
andREADME
files. Added new tests and examples.So this entity is easier to implement and it is enough to mock tests that require working
Connection
. All new mock structs and an example forMockDoer
usage are added to thetest_helpers
package.Added new structs
MockDoer
,MockRequest
totest_helpers
. RenamedStrangerResponse
toMockResponse
.Added new connection log constant:
LogAppendPushFailed
. It is logged when connection fails to append a push response.Closes #237
I didn't forget about (remove if it is not applicable):