Skip to content
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

Integration tests version handling #613

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

lgetwan
Copy link
Contributor

@lgetwan lgetwan commented Jun 4, 2024

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Previously, the version dependencies (e.g. different format in the raw_value) in the tests were handled by the task/test.yml.

What is the new behavior?

  • Introduced separate variable files for each Checkmk version.
  • Fixed a typo in an author's name.
  • Removed the "Create rules. Oldschool." tasks, as they are already handled by the given test cases.

Other Information

When using a registered variable from a previous rule module task, please take care when using the raw_value. Ansible will interpret the value and probably change it. To restrict that, use the "string" filter like that:

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Modify rules."
  rule:
    server_url: "{{ checkmk_var_server_url }}"
    site: "{{ outer_item.site }}"
    automation_user: "{{ checkmk_var_automation_user }}"
    automation_secret: "{{ checkmk_var_automation_secret }}"
    ruleset: "{{ item.content.extensions.ruleset }}"
    rule:
      rule_id: "{{ item.content.id }}"
      conditions: "{{ item.content.extensions.conditions }}"
      properties:
          comment: "{{ item.content.extensions.properties.comment | default('') }}"
          description: "New description"
      value_raw: "{{ item.content.extensions.value_raw | string }}"
    state: "present"
  loop: "{{ created_rules.results }}"

@lgetwan lgetwan self-assigned this Jun 4, 2024
@lgetwan lgetwan requested a review from robin-checkmk as a code owner June 4, 2024 09:58
@github-actions github-actions bot added the module:rule This affects the rule module label Jun 4, 2024
@lgetwan lgetwan added the documentation Improvements or additions to documentation label Jun 4, 2024
@lgetwan
Copy link
Contributor Author

lgetwan commented Jun 4, 2024

All tests successful, including the rule integration tests. :-)
@robin-checkmk: Please check and merge, if you're fine with it.

@robin-checkmk robin-checkmk mentioned this pull request Jun 4, 2024
7 tasks
Copy link
Member

@robin-checkmk robin-checkmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the approach! 🏇

Might be a little added effort to maintain the rules, but I think it is worth it. 👍

@robin-checkmk robin-checkmk merged commit a5e5a74 into devel Jun 4, 2024
50 checks passed
@robin-checkmk robin-checkmk deleted the feature/integration-tests-version-handling branch June 4, 2024 21:46
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation module:rule This affects the rule module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants