-
Notifications
You must be signed in to change notification settings - Fork 4
feat: allow partial scans #1492
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,15 @@ | |
| from server import EventServer | ||
|
|
||
|
|
||
| def reload_config( | ||
| fact: docker.models.containers.Container, config: dict, config_file: str | ||
| ): | ||
| with open(config_file, 'w') as f: | ||
| yaml.dump(config, f) | ||
| fact.kill('SIGHUP') | ||
| sleep(0.1) | ||
|
Comment on lines
+17
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Wait for reload completion instead of a fixed delay.
Wait for observable reload completion before returning. For this integration suite, the enabled test-only Based on learnings, introspection endpoints are dev/testing-only. 🤖 Prompt for AI AgentsSource: Learnings
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @CodeRabbit, this is a good point, but change how the tests work is outside the scope of the PR. Will address when we have time to work on test tech-debt. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would you like me to open a follow-up GitHub issue for the reload synchronization test technical debt? You are interacting with an AI system. |
||
|
|
||
|
|
||
| @pytest.fixture | ||
| def wildcard_config( | ||
| fact: docker.models.containers.Container, | ||
|
|
@@ -23,12 +32,22 @@ def wildcard_config( | |
| f'{monitored_dir}/*.conf', | ||
| f'{monitored_dir}/**/test-*.log', | ||
| ] | ||
| with open(config_file, 'w') as f: | ||
| yaml.dump(config, f) | ||
|
|
||
| # reload the config | ||
| fact.kill('SIGHUP') | ||
| sleep(0.1) | ||
| reload_config(fact, config, config_file) | ||
| return config, config_file | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def partial_path_match_wildcard( | ||
| fact: docker.models.containers.Container, | ||
| fact_config: tuple[dict, str], | ||
| ignored_dir: str, | ||
| ): | ||
| config, config_file = fact_config | ||
| partial_dir = ignored_dir.rsplit('-', 1)[0] | ||
| config['paths'] = [f'{partial_dir}*/**/*', f'{partial_dir}*'] | ||
|
|
||
| reload_config(fact, config, config_file) | ||
| return config, config_file | ||
|
|
||
|
|
||
|
|
@@ -197,3 +216,25 @@ def test_multiple_patterns( | |
| ] | ||
|
|
||
| server.wait_events(events) | ||
|
|
||
|
|
||
| def test_partial_dir_pattern( | ||
| partial_path_match_wildcard: tuple[dict, str], | ||
| ignored_dir: str, | ||
| server: EventServer, | ||
| ): | ||
| process = Process.from_proc() | ||
| file = os.path.join(ignored_dir, 'file.txt') | ||
| with open(file, 'w') as f: | ||
| f.write('This is a test') | ||
|
|
||
| server.wait_events( | ||
| [ | ||
| Event( | ||
| process=process, | ||
| event_type=EventType.CREATION, | ||
| file=file, | ||
| host_path=file, | ||
| ) | ||
| ] | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.