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

Integration test suite #317

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Jan 16, 2025

Having a test suite that covers the code from an out-of-process perspective helps
in testing specific scenarios, e.g. when the concurrency of multiple program instances
occurs. Also, using test doubles instead of real SR-IOV capable NICs makes tests fast
and portable, in a way that can be run at every commit.

Add a test suite that invokes a system-mocked version of the sriov CNI binary, in which
the /sys filesystem content is defined at code, and the network interfaces are of type dummy.

Add test-integration make target to invoke the test suite
Move cni commands to pkg/cnicommands package
Allow injecting NetlinkManager in SriovManager

f, err := os.OpenFile(p.methodCallsRecordingFilePath,
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Println(err)

Check warning

Code scanning / CodeQL

Writable file handle closed without error handling Warning test

File handle may be writable as a result of data flow from a
call to OpenFile
and closing it may result in data loss upon failure, which is not handled explicitly.
@zeeke zeeke force-pushed the us/integration-tests branch 3 times, most recently from 819bcfa to 423fe1c Compare January 16, 2025 10:59
@coveralls
Copy link

coveralls commented Jan 16, 2025

Pull Request Test Coverage Report for Build 12810022153

Details

  • 0 of 381 (0.0%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-4.1%) to 37.314%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/sriov/sriov.go 0 1 0.0%
cmd/sriov/main.go 0 3 0.0%
pkg/utils/netlink_manager.go 0 3 0.0%
test/integration/sriov-mocked.go 0 30 0.0%
pkg/utils/testing.go 0 115 0.0%
pkg/cnicommands/cni.go 0 229 0.0%
Files with Coverage Reduction New Missed Lines %
cmd/sriov/main.go 1 0.0%
Totals Coverage Status
Change from base Build 12743187155: -4.1%
Covered Lines: 553
Relevant Lines: 1482

💛 - Coveralls

@zeeke zeeke force-pushed the us/integration-tests branch 4 times, most recently from d8f433c to 7c1f069 Compare January 16, 2025 11:54
Having a test suite that covers the code from an out-of-process perspective helps
in testing specific scenarios, e.g. when the concurrency of multiple program instances
occurs. Also, using test doubles instead of real SR-IOV capable NICs makes tests fast
and portable, in a way that can be run at every commit.

Add a test suite that invokes a system-mocked version of the sriov CNI binary, in which
the `/sys` filesystem content is defined at code, and the network interfaces are of type dummy.

Add `test-integration` make target to invoke the test suite.

Signed-off-by: Andrea Panattoni <[email protected]>
@zeeke zeeke force-pushed the us/integration-tests branch from 7c1f069 to 212d2b1 Compare January 16, 2025 13:33
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

Successfully merging this pull request may close these issues.

2 participants