-
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
discoverServer: handle Close #571
discoverServer: handle Close #571
Conversation
var nodesCount, nscNode, expectedPathSegments int | ||
if remote { | ||
nodesCount = 2 | ||
nscNode = 1 | ||
expectedPathSegments = 8 | ||
} else { | ||
nodesCount = 1 | ||
nscNode = 0 | ||
expectedPathSegments = 5 | ||
} |
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.
Please consider extracting testSample struct and using for loop over samples
type testSample struct {
nodesCount uint
nscNode uint
nseNode uint
reRequestsCount unit
expectedPathSegments unit
expectedreRequestsCount unit
}
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.
I don't feel that the only two cases worth generalizing.
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.
- Actually you already generalized these two cases
- With
testSample
we can cover many cases such as
2.1. nsc - node1, nse - node 2
2.2. nsc - node2, nse - node1
2.3. nsc - node1, nse -node1 (nodesCount=1),
2.4. nsc - node2, nse -node2 (nodesCount=2)
2.6. all above scenarious with reRequestsCount = 2
2.7. all above scenarious with reRequestsCount = 5
2.7. all above scenarious with reRequestsCount = 10 - test pattern with testSample looks more better than adding method with bolean logic.
But I would recommend do not touch these tests and just add test for close into discover pkg.
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, please add using of atomic to prevent race conditions
@@ -318,3 +328,17 @@ func (p *passThroughClient) Close(ctx context.Context, conn *networkservice.Conn | |||
conn = conn.Clone() | |||
return next.Client(ctx).Close(ctx, conn, opts...) | |||
} | |||
|
|||
type counterServer struct { | |||
Requests, Closes int |
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.
Please use atomic int32 to prevent race condition in case of a testing parallel request from a few clients
Signed-off-by: Albert Safin <albert.safin@xored.com>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@master networkservicemesh/sdk#571 networkservicemesh/sdk PR link: networkservicemesh/sdk#571 networkservicemesh/sdk commit message: commit 636615f67bfe8d351eb73223acb52e697cecf4ce Author: xzfc <xzfc@users.noreply.github.com> Date: Thu Nov 12 15:23:06 2020 +0000 discoverServer: handle Close (#571) Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: Sergey Ershov <sergey.ershov@xored.com>
Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: Sergey Ershov <sergey.ershov@xored.com>
Signed-off-by: Albert Safin <albert.safin@xored.com> Signed-off-by: Sergey Ershov <sergey.ershov@xored.com>
This PR fixes #570 for Local/Remote one-hop NSMgr use-cases.