Skip to content
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

Merged
merged 11 commits into from
Feb 20, 2020
Merged

Conversation

lvfxx
Copy link
Member

@lvfxx lvfxx commented Feb 17, 2020

Fixes to make clientInfo NetworkServiceRegistryClient tests work

}

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...)
Copy link
Member

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).

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, did it

Copy link
Member

@edwarnicke edwarnicke left a 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

Copy link
Member

@denis-tingaikin denis-tingaikin left a 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{}
Copy link
Member

@denis-tingaikin denis-tingaikin Feb 17, 2020

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.

Copy link
Member Author

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>
@lvfxx lvfxx force-pushed the registry-client-fixes branch from 1195ace to 31c6aca Compare February 18, 2020 11:44
Copy link
Member

@denis-tingaikin denis-tingaikin left a 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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Member

@edwarnicke edwarnicke left a 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>
@lvfxx lvfxx requested review from edwarnicke and haiodo February 19, 2020 04:34
@edwarnicke edwarnicke merged commit b8ce689 into networkservicemesh:master Feb 20, 2020
@lvfxx lvfxx deleted the registry-client-fixes branch February 21, 2020 05:17
nsmbot pushed a commit that referenced this pull request Sep 7, 2021
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants