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

Quality upgrade for NSM chain element testing #1618

Open
denis-tingaikin opened this issue May 7, 2024 · 0 comments
Open

Quality upgrade for NSM chain element testing #1618

denis-tingaikin opened this issue May 7, 2024 · 0 comments

Comments

@denis-tingaikin
Copy link
Member

denis-tingaikin commented May 7, 2024

Motivation 

Most chain elements are handling resources somehow. Some elements create a private map for storing states; some of them use a metadata map from the context; some of them handle context-related events; and some of them do not, some of them doesn't handle error on the refresh request.

The inconsistent behavior produces memory leaks and unexpected behavior.

It's a root cause of networkservicemesh/cmd-nsmgr#675.

Solution

Define a set of must have checks for the chain element that will check does the element follow required conditions. The interface could be simple:

package sandbox

func TestClientEdgeCases(t *testing.T, c networkservice.NetworkServiceClient) {/* TODO  */ }
func TestServerEdgeCases(t *testing.T, s networkservice.NetworkServiceServer) {/* TODO */ }

Example of usage:

package metrics_test

import "sandbox"
import "metrics"

// should be added in each chain element
func TestEdgeCases(t *testing.T) {
    sandbox.TestServerEdgeCases(t, metrics.NewServer())
    sandbox.TestClientEdgeCases(t, metrics.NewClient())
}

Scenarios

  1. sequence of request + close => should not produce cpu/memory leaks
  2. sequence of request + request failed by timeout => should not produce cpu/memory leaks
  3. sequence of request + request failed by error in next => should not produce cpu/memory leaks
  4. sequence of request + error in next => should not produce cpu/memory leaks
  5. sequence of request + error in next + close => should not produce cpu/memory leaks
@denis-tingaikin denis-tingaikin changed the title Quality upgrade for NSM chain elements Quality upgrade for NSM chain element testing May 7, 2024
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

No branches or pull requests

1 participant