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

chore: Refactor Captures to use Contexts #1307

Merged
merged 5 commits into from
Feb 10, 2025

Conversation

kamilprz
Copy link
Contributor

@kamilprz kamilprz commented Feb 5, 2025

Description

Refactoring the capture manager and capture commands to create a context hierarchy by passing it around, rather than creating a new one in each method with context.TODO.

Related Issue

#317

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Additional Notes

https://go.dev/blog/context


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@kamilprz kamilprz requested a review from a team as a code owner February 5, 2025 10:24
@kamilprz
Copy link
Contributor Author

kamilprz commented Feb 5, 2025

@timraymond @alexcastilio please take a look and point out mistakes or ways to make things better :)

Also in terms of testing, make test succeeds with 0 failures - do we deem that enough of a validation that things are ok? I'm not entirely sure how to validate scenarios where the context is cancelled? Would it just be running a capture and terminating with Ctrl+C?

Signed-off-by: Kamil <[email protected]>
timraymond
timraymond previously approved these changes Feb 6, 2025
Copy link
Member

@timraymond timraymond left a comment

Choose a reason for hiding this comment

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

Looks great! One quick suggestion, but nothing blocking.

pkg/capture/crd_to_job_test.go Outdated Show resolved Hide resolved
Signed-off-by: Kamil <[email protected]>
Signed-off-by: Kamil <[email protected]>
@kamilprz kamilprz added this pull request to the merge queue Feb 10, 2025
Merged via the queue into microsoft:main with commit ee81a41 Feb 10, 2025
28 checks passed
@kamilprz kamilprz deleted the context-todo branch February 10, 2025 15:27
@kamilprz kamilprz linked an issue Feb 10, 2025 that may be closed by this pull request
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.

Capture Manager should use contexts
2 participants