Skip to content

Commit

Permalink
Rename forward_events to test_mode to be consistent with the API
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis committed Oct 8, 2024
1 parent a219695 commit 3f64ad6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 19 additions & 5 deletions plugins/modules/event_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@
type: str
default: ''
version_added: 2.1.0
forward_events:
test_mode:
description:
- Enable the event stream to forward events to the rulebook activation where it is configured.
- The O(forward_events) alias has been deprecated and will be removed in release 4.0.0.
type: bool
default: True
default: true
version_added: 2.1.0
aliases:
- forward_events
state:
description:
- Desired state of the resource.
Expand Down Expand Up @@ -117,8 +120,8 @@ def create_params(module: AnsibleModule, controller: Controller) -> dict[str, An
if module.params.get("event_stream_type"):
credential_params["event_stream_type"] = module.params["event_stream_type"]

if module.params.get("forward_events") is not None:
credential_params["test_mode"] = module.params["forward_events"]
if module.params.get("test_mode") is not None:
credential_params["test_mode"] = module.params["test_mode"]

if module.params.get("headers"):
credential_params["additional_data_headers"] = module.params["headers"]
Expand Down Expand Up @@ -156,7 +159,18 @@ def main() -> None:
organization_name=dict(type="str", aliases=["organization"]),
event_stream_type=dict(type="str", aliases=["type"]),
headers=dict(type="str", default=""),
forward_events=dict(type="bool", default=True),
test_mode=dict(
type="bool",
default=True,
aliases=["forward_events"],
deprecated_aliases=[
dict(
name="forward_events",
version="4.0.0",
collection_name="ansible.eda",
)
],
),
state=dict(choices=["present", "absent"], default="present"),
)

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/event_stream/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
name: "{{ event_stream_name }}"
credential_name: "{{ credential_name }}"
organization_name: Default
forward_events: False
test_mode: false
event_stream_type: Basic Event Stream
check_mode: true
register: _result
Expand Down Expand Up @@ -133,15 +133,15 @@
that:
- _result.event_streams[0].name == new_event_stream_name

- name: Update event stream headers and forward_events
- name: Update event stream headers and test_mode
ansible.eda.event_stream:
state: present
name: "{{ new_event_stream_name }}"
credential_name: "{{ credential_name }}"
organization_name: Default
event_stream_type: "Basic Event Stream"
headers: "Authorization,Custom-Header"
forward_events: False
test_mode: false
register: _result

- name: Check event stream is updated
Expand All @@ -154,7 +154,7 @@
name: "{{ new_event_stream_name }}"
register: _result

- name: Check if event stream headers and forward_events are updated
- name: Check if event stream headers and test_mode are updated
assert:
that:
- _result.event_streams[0].name == new_event_stream_name
Expand Down

0 comments on commit 3f64ad6

Please sign in to comment.