-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adding a test that checks that collectd memory limit set to 512Mb #227
base: master
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 |
---|---|---|
|
@@ -28,3 +28,11 @@ | |
register: stat | ||
changed_when: false | ||
failed_when: stat.stdout_lines|length == 0 | ||
|
||
- name: TEST Check the collectd memory limit is set to 512Mb | ||
ansible.builtin.shell: | | ||
{{ container_bin }} inspect {{ collectd_container_name }} | grep 512 -c | ||
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. IMHO, it would be better to search also for the right property in the container information. Searching for just 512 could cause a false pass if the characters appear in a hash, for example, such as what I got when querying an arbitrary container in my system:
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. The memory limit is represented in B. A container run with a memory limit of 512M will actually fail this test. Run a container and set the memory limit to 512M:
Then find the name
Podman allows updating the properties of a container, including the memory limits, so even detecting the options used to deploy a container may not represent the properties. I suggest either modifying the grep command, or using jq (which we might already use elsewhere in the tests. For a modified grep command, try
Which will match something like this:
The fail condition for the ansible task can be:
|
||
register: memory | ||
changed_when: false | ||
failed_when: memory.stdout_lines|length == 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest renaming this to not include the specific value for the memory limit, in case it changes again.
i.e. "TEST Check the collectd memory limit"
Optional update