Skip to content

Commit

Permalink
Fix memory registry slow receiver test
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Feb 5, 2021
1 parent 40e3c98 commit b362e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions pkg/registry/common/memory/ns_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,13 @@ func TestNetworkServiceRegistryServer_SlowReceiver(t *testing.T) {
findCtx, findCancel := context.WithCancel(ctx)

stream, err := c.Find(findCtx, &registry.NetworkServiceQuery{
NetworkService: &registry.NetworkService{Name: "ns-1"},
NetworkService: &registry.NetworkService{Name: "ns"},
Watch: true,
})
require.NoError(t, err)

for i := 0; i < 100; i++ {
var ns *registry.NetworkService
ns, err = s.Register(ctx, &registry.NetworkService{Name: "ns-1"})
require.NoError(t, err)

_, err = s.Unregister(ctx, ns)
for i := 0; i < 200; i++ {
_, err = s.Register(ctx, &registry.NetworkService{Name: fmt.Sprintf("ns-%d", i)})
require.NoError(t, err)
}

Expand Down
10 changes: 3 additions & 7 deletions pkg/registry/common/memory/nse_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,13 @@ func TestNetworkServiceEndpointRegistryServer_SlowReceiver(t *testing.T) {
findCtx, findCancel := context.WithCancel(ctx)

stream, err := c.Find(findCtx, &registry.NetworkServiceEndpointQuery{
NetworkServiceEndpoint: &registry.NetworkServiceEndpoint{Name: "nse-1"},
NetworkServiceEndpoint: &registry.NetworkServiceEndpoint{Name: "nse"},
Watch: true,
})
require.NoError(t, err)

for i := 0; i < 100; i++ {
var nse *registry.NetworkServiceEndpoint
nse, err = s.Register(ctx, &registry.NetworkServiceEndpoint{Name: "nse-1"})
require.NoError(t, err)

_, err = s.Unregister(ctx, nse)
for i := 0; i < 200; i++ {
_, err = s.Register(ctx, &registry.NetworkServiceEndpoint{Name: fmt.Sprintf("nse-%d", i)})
require.NoError(t, err)
}

Expand Down

0 comments on commit b362e5c

Please sign in to comment.