Skip to content

Commit

Permalink
Change export test variable to a string attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-laterman committed Aug 12, 2021
1 parent 4442041 commit 462ce60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions libbeat/tests/system/config/mockbeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ setup.ilm:

#================================ Logging =====================================

{% if metrics_period -%}
logging.metrics.period: {{ metrics_period }}
{% if file_name -%}
logging.files.name: {{ file_name }}
{%- endif %}

{% if keystore_path %}
Expand Down
10 changes: 5 additions & 5 deletions libbeat/tests/system/test_cmd_export_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ def test_default(self):
"""
Test export config works
"""
self.render_config_template(self.beat_name, self.output, metrics_period='1234')
self.render_config_template(self.beat_name, self.output, file_name='some-file')
exit_code = self.run_beat(extra_args=["export", "config"], config=self.config)

assert exit_code == 0
assert self.log_contains("filename: mockbeat")
assert self.log_contains("period: 1234")
assert self.log_contains("name: some-file")

def test_config_environment_variable(self):
"""
Test export config works but doesn"t expose environment variable.
"""
self.render_config_template(self.beat_name, self.output,
metrics_period="${METRIC_PERIOD}")
file_name="${FILE_NAME}")
exit_code = self.run_beat(extra_args=["export", "config"], config=self.config,
env={'METRIC_PERIOD': '1234'})
env={'FILE_NAME': 'some-file'})

assert exit_code == 0
assert self.log_contains("filename: mockbeat")
assert self.log_contains("period: ${METRIC_PERIOD}")
assert self.log_contains("name: ${FILE_NAME}")

0 comments on commit 462ce60

Please sign in to comment.