File Content

This assertion type helps you to verify if a certain text can be found inside the content of a file.

This is based on a "string contains" check.

Expecting

Use this type to verify that the expected content does exist in the file.

file_content:
    - name: "Verify webservice entry in /etc/hosts"
      file: "/etc/hosts"
      expected: "my-webservice x.x.x.x"

Not Expecting

Use this type to ensure that the content does not exist in the file.

file_content:
    - name: "Verify webservice entry not in /etc/hosts"
      file: "/etc/hosts"
      not_expected: "my-webservice x.x.x.x"

Last updated