-
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
Fix registry client #110
Fix registry client #110
Conversation
} | ||
|
||
func (n *nextRegistryClient) BulkRegisterNSE(ctx context.Context, opts ...grpc.CallOption) (registry.NetworkServiceRegistry_BulkRegisterNSEClient, error) { | ||
if n.index+1 < len(n.clients) { | ||
return n.clients[n.index].BulkRegisterNSE(withNextRegistryClient(ctx, &nextRegistryClient{clients: n.clients, index: n.index + 1}), opts...) | ||
} | ||
return n.clients[n.index].BulkRegisterNSE(withNextRegistryClient(ctx, nil), opts...) | ||
return n.clients[n.index].BulkRegisterNSE(withNextRegistryClient(ctx, &tailRegistryClient{}), opts...) |
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.
Move the &tailRegistryClient{} to context.go (see #106 for the example for chaining networkservice).
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.
This makes it safe to run a chain element even its not in a chain.
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.
Ok, did it
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.
See comments about putting *tailRegistryClient{} in the context.go
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 add a unit test for this issue
|
||
// tailRegistryClient is a simple implementation of registry.NetworkServiceRegistryClient that is called at the end | ||
// of a chain to ensure that we never call a method on a nil object | ||
type tailRegistryClient struct{} |
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.
Do we need to add the same thing for next.RegistryServer
?
I guess we need to check that pkg/registry/next
for RegistryClient
/RegistryServer
is working as expected.
Let's cover pkg/registry/next
by unit tests and fix problems.
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.
Yes, we need. I've added it
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com> Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com> Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
1195ace
to
31c6aca
Compare
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.
Looks good to me
func NewRegistryServer(server []registry.NetworkServiceRegistryServer) registry.NetworkServiceRegistryServer { | ||
return NewWrappedRegistryServer(nil, server...) | ||
func NewRegistryServer(servers ...registry.NetworkServiceRegistryServer) registry.NetworkServiceRegistryServer { | ||
if len(servers) == 0 { |
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.
Nice catch!
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.
Can we move pkg/registry/core/next/tests/ up to pkg/registry/core/next/ using package 'next_test' in keeping with standard go idioms?
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
Signed-off-by: Sergey Semenov <sergey.semenov@xored.com>
…i@main PR link: networkservicemesh/api#110 Commit: 9a36433 Author: Vladimir Popov Date: 2021-09-08 02:48:27 +0700 Message: - [sdk-vpp#314] Add SR-IOV token ID mechanism parameter for kernel, VFIO mechanisms (#110) * Add SR-IOV token ID mechanism parameter for kernel, VFIO mechanisms Signed-off-by: Vladimir Popov <vladimir.popov@xored.com> * Renam SR-IOV token ID to just token ID Signed-off-by: Vladimir Popov <vladimir.popov@xored.com> * Rename token ID to device token ID Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Fixes to make clientInfo NetworkServiceRegistryClient tests work