-
Notifications
You must be signed in to change notification settings - Fork 36
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
heal.Client tests and minor fixes #82
heal.Client tests and minor fixes #82
Conversation
54be6e8
to
e6aad9b
Compare
@edwarnicke please take a look, I moved test to |
Have you rebased recently? We discovered a couple of days ago the linter wasn't running properly. In fixing it we corrected a ton of linting. There are a lot of changes in this PR that look like your ID is applying linting to an older-than-that-fix instance of the code, which makes it seem like more change than there is. |
Its probably worth talking a bit about the lifecycle of heal.NewClient. heal.NewClient basically is part of a Client instance, meaning its pointing to a single grpc.ClientConnInterface. It may have many connections Requested, simultaneously open, and then at various times Closed in its lifecycle. We only really want to make sure we aren't leaking things when heal.NewClient is really finished with its life (meaning we are for some reason discarding the struct). The old finalizer approach was trying to do that. It seems that the new approach here is moving to a per-connection lifecycle. I don't quite follow why, but would be interested to understand it :) |
7f9823f
to
07eb8f6
Compare
@edwarnicke There were a bug, in func (f *healClient) lazyInit(id string) {
f.updateExecutor.SyncExec(func() {
if len(f.connectionIDs) == 0 {
f.updateExecutor.AsyncExec(f.init)
}
f.connectionIDs[id] = true
})
}
func (f *healClient) lazyTearDown(id string) {
f.updateExecutor.SyncExec(func() {
delete(f.connectionIDs, id)
if len(f.connectionIDs) == 0 {
f.updateExecutor.AsyncExec(f.tearDown)
}
})
} So they start monitoring after the first @haiodo has also nice idea - create |
This sounds like a very very good idea. |
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
350962b
to
8fcb6fd
Compare
@edwarnicke please take a look, I rebased on latest changes and removed |
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
switch event.GetType() { | ||
case networkservice.ConnectionEventType_INITIAL_STATE_TRANSFER: | ||
f.reported = event.GetConnections() | ||
if event.GetConnections() == 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.
Why are we zeroing out reported here rather than taking what is coming from INITIAL_STATE_TRANSFER?
And I don't see how we are correctly handling the re-request case for an INITIAL_STATE_TRANSFER that is missing some of the connections we think we have.
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.
If we write empty slice to grpc stream, we receive it like nil
. AFAIK nil and empty map looks the same for grpc.
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.
At least I faced with panic
here if the first INITIAL_STATE_TRANSFER is empty
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.
Oh... I see now :)
Signed-off-by: Ilya Lobkov <ilya.lobkov@xored.com>
Please move the test things from pkg/test/ to being in context in the monitor/ directory. Please for the moment put them into the monitor_test package in the monitor directory... until we actually need to reuse the test machinery, lets not export it. |
Have a look at #109 for an example of how to test without having to introduce a ton of new machinery :) |
Added unit-tests for heal.Client, fix minor issues