Skip to content

Commit

Permalink
[test] With NSE expiration
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
  • Loading branch information
glazychev-art committed Oct 29, 2021
1 parent ee7e89c commit 1a7a430
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Build
run: go build -race ./...
- name: Test
run: go test -race -count 50 -run "TestNSMGR_.*" -timeout 1h ./...
run: go test -race -count 50 -run "TestNSMGR_CloseHeal" -timeout 1h ./...
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions pkg/networkservice/chains/nsmgr/heal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ func TestNSMGR_CloseHeal(t *testing.T) {
name string
withNSEExpiration bool
}{
{
name: "Without NSE expiration",
},
//{
// name: "With NSE expiration",
// withNSEExpiration: true,
// name: "Without NSE expiration",
//},
{
name: "With NSE expiration",
withNSEExpiration: true,
},
}

for _, sample := range samples {
Expand Down
10 changes: 9 additions & 1 deletion pkg/registry/common/memory/nse_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func (s *memoryNSEServer) Find(query *registry.NetworkServiceEndpointQuery, serv

s.executor.AsyncExec(func() {
s.eventChannels[id] = eventCh
for _, entity := range s.allMatches(query) {
matches := s.allMatches(query)
if len(matches) == 0 {
eventCh <- nil
return
}
for _, entity := range matches {
eventCh <- entity
}
})
Expand Down Expand Up @@ -142,6 +147,9 @@ func (s *memoryNSEServer) receiveEvent(
case <-server.Context().Done():
return io.EOF
case event := <-eventCh:
if event == nil {
return nil
}
if matchutils.MatchNetworkServiceEndpoints(query.NetworkServiceEndpoint, event) {
if err := server.Send(event); err != nil {
if server.Context().Err() != nil {
Expand Down

0 comments on commit 1a7a430

Please sign in to comment.