Skip to content

Commit

Permalink
Fix Python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rdner committed Jan 16, 2025
1 parent 5c3bd44 commit a9aa39c
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 29 deletions.
26 changes: 16 additions & 10 deletions filebeat/tests/files/config.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
filebeat:
inputs:
- # Paths that should be crawled and fetched
-
# Paths that should be crawled and fetched
paths:
- /var/log/app*.log
- /var/log/s*.log
# Input: This must be either log or stdin
type: filestream
input: log
allow_deprecated_use: true
# Optional additional fields
fields:
level: debug
review: 1
type: filestream
type: log
ignore_older: 0
close.on_state_change.inactive: 5m
prospector.scanner.check_interval: 10s
buffer_size: 5000
- fields:
close_inactive: 5m
scan_frequency: 10s
harvester_buffer_size: 5000
tail_files: false
-
fields:
paths:
- /var/log/test.log
type: filestream
- fields:
type: stdin
input: log
allow_deprecated_use: true
-
fields:
input: stdin
# Paths is not required
spool_size: 2048
idle_timeout: 5s
Expand Down
12 changes: 8 additions & 4 deletions filebeat/tests/load/filebeat.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
filebeat:
inputs:
- type: filestream
- type: log
allow_deprecated_use: true
paths:
- /Users/ruflin/Dev/gopath/src/github.com/elastic/filebeat/tests/load/logs/*

#fields:
# level: debug
# review: 1
ignore_older: 0
close.on_state_change.inactive: 5m
prospector.scanner.check_interval: 0s
buffer_size: 1000000
close_inactive: 5m
scan_frequency: 0s
harvester_buffer_size: 1000000

spool_size: 4096
idle_timeout: 5s
Expand All @@ -22,6 +23,7 @@ filebeat:
# Configure what outputs to use when sending the data collected by filebeat.
# You can enable one or multiple outputs by setting enabled option to true.
output:

## File as output
file:
# Path to the directory where to save the generated files. The option is mandatory.
Expand All @@ -30,6 +32,8 @@ output:
rotate_every_kb: 10000
number_of_files: 100



logging:
to_files: true
#selectors: ["*"]
Expand Down
22 changes: 12 additions & 10 deletions filebeat/tests/open-file-handlers/filebeat.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
filebeat.inputs:
# Reads logs generated by the generator containers
- type: filestream
paths:
- /logfiles/*
close.on_state_change.inactive: 1m
ignore_older: 2m
clean_inactive: 5m

# Reads logs generated by the generator containers
- type: log
allow_deprecated_use: true
paths:
- /logfiles/*
close_inactive: 1m
ignore_older: 2m
clean_inactive: 5m

# Reads docker container logs
#- type: filestream
#- type: log
# paths:
# - /var/lib/docker/containers/*/*-json.log

# Reads system logs
#- type: filestream
# Reads system logs
#- type: log
# paths:
# - /var/log/*
#
Expand Down
1 change: 1 addition & 0 deletions filebeat/tests/system/config/filebeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ filebeat.{{input_config | default("inputs")}}:
{% endif %}
{% if inputs %}
- type: {{type | default("log") }}
allow_deprecated_use: true
input_type: {{input_type_deprecated }}
# Paths that should be crawled and fetched
{% if path %}paths:
Expand Down
1 change: 1 addition & 0 deletions filebeat/tests/system/config/filebeat_inputs.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ filebeat.inputs:
- paths:
- {{input.path}}
scan_frequency: 0.5s
allow_deprecated_use: true
encoding: {{input.encoding | default("plain") }}
{% endfor %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
type: filestream
type: log
allow_deprecated_use: true
paths:
{{ range $i, $path := .paths }}
- {{$path}}
Expand Down
3 changes: 2 additions & 1 deletion filebeat/tests/system/module/test/test/config/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
type: filestream
type: log
allow_deprecated_use: true
paths:
{{ range $i, $path := .paths }}
- {{$path}}
Expand Down
3 changes: 2 additions & 1 deletion filebeat/tests/system/test_autodiscover.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_docker(self):
equals.docker.container.name: {container.name}
config:
- type: filestream
id: ${data.container.name}
paths:
- %s/${{data.docker.container.name}}.log
''' % self.working_dir,
Expand Down Expand Up @@ -58,7 +59,7 @@ def test_default_settings(self):
'hints.enabled': 'true',
'hints.default_config': '''
type: filestream
id: ${data.container.name}-${data.container.id}
id: ${data.container.name}
paths:
- %s/${data.container.name}.log
''' % self.working_dir,
Expand Down
3 changes: 3 additions & 0 deletions filebeat/tests/system/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def test_container_input(self):
"""
input_raw = """
- type: container
allow_deprecated_use: true
paths:
- {}/logs/*.log
"""
Expand Down Expand Up @@ -44,6 +45,7 @@ def test_container_input_cri(self):
"""
input_raw = """
- type: container
allow_deprecated_use: true
paths:
- {}/logs/*.log
"""
Expand Down Expand Up @@ -74,6 +76,7 @@ def test_container_input_registry_for_unparsable_lines(self):
"""
input_raw = """
- type: container
allow_deprecated_use: true
paths:
- {}/logs/*.log
"""
Expand Down
2 changes: 2 additions & 0 deletions filebeat/tests/system/test_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ def test_encodings(self):
inputs = []
for enc_go, enc_py, _ in encodings:
inputs.append({
"type": "log",
"allow_deprecated_use": True,
"path": self.working_dir + "/log/test-{}".format(enc_py),
"encoding": enc_go
})
Expand Down
2 changes: 2 additions & 0 deletions filebeat/tests/system/test_registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,9 +1352,11 @@ def test_registrar_meta(self):
self.render_config_template(
type='container',
input_raw='''
allow_deprecated_use: true
paths: {path}
stream: stdout
- type: container
allow_deprecated_use: true
paths: {path}
stream: stderr
'''.format(path=os.path.abspath(self.working_dir) + "/log/*/*.log")
Expand Down
5 changes: 3 additions & 2 deletions filebeat/tests/system/test_reload_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@


inputConfigTemplate = """
- type: filestream
- type: log
allow_deprecated_use: true
paths:
- {}
prospector.scanner.check_interval: 1s
scan_frequency: 1s
"""


Expand Down
2 changes: 2 additions & 0 deletions filebeat/tests/system/test_reload_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ def test_wrong_module_no_reload(self):
enabled: true
wrong_field: error
input:
type: log
allow_deprecated_use: true
scan_frequency: 1s
"""
with open(config_path, 'w') as f:
Expand Down

0 comments on commit a9aa39c

Please sign in to comment.