google / google/gvisor

Add utility functions to help unit tests verify netstack Stats

Open
#5,559 0 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 7h
Merged PRs (30d)
275

Description

**Description**

Many of the netstack unit tests need to check that the stats got updated correctly after some functions is called. Having a standard way to do this will reduce the code size of many of our unit tests and keep the code readable while improving value we get out of the tests.

**Do you have a specific solution in mind?**

One way to do this would be to have a way to capture a snapshot of the stats (or a subset, say `tcpip.Stats.IP`) at a given moment in time (eg. right before we call the function(s) under test) and another function that outputs the diff, in a format that is easy for test cases to encode in their parameters.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.