mirror of
https://github.com/nspcc-dev/neofs-sdk-go.git
synced 2026-03-01 04:29:18 +00:00
Cover client package with unit tests #108
Labels
No labels
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U2
U2
U3
U4
blocked
bug
client
config
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
performance
pool
question
security
task
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-sdk-go#108
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cthulhu-rider on GitHub (Jun 15, 2022).
Testing of
clientpackage is pretty complex but necessary. We need to mock remote server and testClienton unit likeAs the first task of the issue I propose to compose list of all test scenarios.
After the list of testcases is ready, there are at least two possible approaches of server mocking described below.
gRPC server with mocked handlers
We can serve gRPC server on some local endpoint and bind mocked handlers. Pros: no need to change the client. Cons: system resources (maybe it's possible to avoid system calls?).
Transport client as an interface
Hide internal client behind the interface and provide a way to change value for testing. Pros: gRPC is not needed at all. Cons: implementation changes.
@cthulhu-rider commented on GitHub (Sep 20, 2022):
Started in #337. When testing other operations, it is worth considering a common test framework: most of the operations use the same scheme, but they differ in some ways.
@gsmachado commented on GitHub (Sep 23, 2022):
❤️ 😍