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

Add test on IPFIX writer #606

Merged
merged 3 commits into from
Feb 26, 2024
Merged

Conversation

jotak
Copy link
Member

@jotak jotak commented Feb 22, 2024

  • Adding a test for the IPFIX exporter
  • Small refactoring to remove some boilerplate code and have all fields more easily accessible

cc @bhale , I believe this test can help you when adding more ipfix fields

The lib is not thread safe as it uses a shared global registry without
proper locks, e.g:

```
 WARNING: DATA RACE
Read at 0x000001fbbde8 by goroutine 28:
  github.com/vmware/go-ipfix/pkg/registry.GetInfoElementFromID()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/vendor/github.com/vmware/go-ipfix/pkg/registry/registry.go:112 +0x3e
  github.com/vmware/go-ipfix/pkg/collector.(*CollectingProcess).decodeTemplateSet()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/vendor/github.com/vmware/go-ipfix/pkg/collector/process.go:248 +0x3e8
  github.com/vmware/go-ipfix/pkg/collector.(*CollectingProcess).decodePacket()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/vendor/github.com/vmware/go-ipfix/pkg/collector/process.go:203 +0x9a4
  github.com/vmware/go-ipfix/pkg/collector.(*CollectingProcess).handleUDPClient.func1()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/vendor/github.com/vmware/go-ipfix/pkg/collector/udp.go:138 +0x28d

Previous write at 0x000001fbbde8 by goroutine 23:
  github.com/vmware/go-ipfix/pkg/registry.LoadRegistry()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/vendor/github.com/vmware/go-ipfix/pkg/registry/registry.go:97 +0x44
  github.com/netobserv/flowlogs-pipeline/pkg/pipeline/write.NewWriteIpfix()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/pkg/pipeline/write/write_ipfix.go:472 +0xaca
  github.com/netobserv/flowlogs-pipeline/pkg/pipeline/write.TestEnrichedIPFIXFlow()
      /home/runner/work/flowlogs-pipeline/flowlogs-pipeline/pkg/pipeline/write/write_ipfix_test.go:93 +0x4e4
```
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 35 lines in your changes are missing coverage. Please review.

Project coverage is 67.03%. Comparing base (07b7a3e) to head (525f0af).
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/pipeline/write/write_ipfix.go 0.00% 35 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #606      +/-   ##
==========================================
+ Coverage   66.09%   67.03%   +0.93%     
==========================================
  Files         103      103              
  Lines        7509     7401     -108     
==========================================
- Hits         4963     4961       -2     
+ Misses       2254     2147     -107     
- Partials      292      293       +1     
Flag Coverage Δ
unittests 67.03% <0.00%> (+0.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jotak jotak added no-qe This PR doesn't necessitate QE approval no-doc This PR doesn't require documentation change on the NetObserv operator labels Feb 22, 2024
Copy link
Contributor

@OlivierCazade OlivierCazade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jotak
Copy link
Member Author

jotak commented Feb 26, 2024

/approve

Copy link

openshift-ci bot commented Feb 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jotak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit ba7ad1f into netobserv:main Feb 26, 2024
12 checks passed
@jotak jotak deleted the test-ipfix branch March 21, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm no-doc This PR doesn't require documentation change on the NetObserv operator no-qe This PR doesn't necessitate QE approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants