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

Fix panic during optimize report #358

Conversation

linkous8
Copy link
Contributor

Description

Fixes error reported by Pavel

fsoc optimize report                                                                                                                     ✔
   ⨯ Execution of report query encountered errors. Returned data may not be complete!
   ⨯ Execution Timeout: Execution timeout! No next data received in interval: PT1M (logged with TraceId: [cfdbf4f98d794132b420e0523ddf950f])
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1049540b8]

goroutine 1 [running]:
github.com/cisco-open/fsoc/cmd/optimize.extractReportData(0x14000717000)
	github.com/cisco-open/fsoc/cmd/optimize/report.go:214 +0x2a8
github.com/cisco-open/fsoc/cmd/optimize.listReports(0x10525da40, {0x1052d7c00?, 0x0?, 0x0?})
	github.com/cisco-open/fsoc/cmd/optimize/report.go:138 +0x524
github.com/spf13/cobra.(*Command).execute(0x10525da40, {0x140000302c0, 0x0, 0x0})
	github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x105259b00)
	github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	github.com/spf13/cobra@v1.8.0/command.go:1032
github.com/cisco-open/fsoc/cmd.Execute(...)
	github.com/cisco-open/fsoc/cmd/root.go:98
main.realMain()
	github.com/cisco-open/fsoc/main.go:36 +0x100
main.main()
	github.com/cisco-open/fsoc/main.go:28 +0x1c 
  • moved test data string to separate files
  • refactor report command to use flags struct for ease of unit testing
  • added unit test with data that was causing a panic in fsoc
  • fixed panic in report command where the events uql.DataSet wasn't checked for nil

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

- moved test data string to separate files
- refactor report command to use flags struct for ease of unit testing
- added unit test with data that was causing a panic in fsoc
- fixed panic in report command where the events uql.DataSet wasn't checked for nil
@codecov-commenter
Copy link

Codecov Report

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

Project coverage is 15.64%. Comparing base (00d0c6f) to head (0c3529f).
Report is 51 commits behind head on main.

Files Patch % Lines
cmd/optimize/report.go 30.95% 51 Missing and 7 partials ⚠️
cmd/optimize/optimize.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #358       +/-   ##
===========================================
- Coverage   26.88%   15.64%   -11.25%     
===========================================
  Files          44      142       +98     
  Lines        4564    11392     +6828     
===========================================
+ Hits         1227     1782      +555     
- Misses       3242     9468     +6226     
- Partials       95      142       +47     

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

@pnickolov pnickolov merged commit 2ad6de3 into cisco-open:main May 2, 2024
8 checks passed
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.

None yet

4 participants