-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(play): Add play level trace span
clean(plugin): Remove code from other work fix(inventory): missing inventory for test one host fix(inventory): missing new line
- Loading branch information
1 parent
b9d7992
commit 234ab54
Showing
7 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
[all] | ||
localhost ansible_connection=local | ||
|
||
[group_a] | ||
127.0.0.1 ansible_connection=local | ||
|
||
[group_b] | ||
127.0.0.1 ansible_connection=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
|
||
- hosts: group_a | ||
name: First play | ||
environment: | ||
CALLBACKS_ENABLED: trace | ||
TRACE_OUTPUT_DIR: /ansible_collections/mhansen/ansible-trace | ||
TRACE_HIDE_TASK_ARGUMENTS: True | ||
tasks: | ||
- name: One task before import | ||
shell: "echo 'Play 1'" | ||
|
||
- name: Second play | ||
import_playbook: otherplays.yml | ||
|
||
- name: Third play | ||
import_playbook: nested.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
|
||
- hosts: group_b | ||
name: Third play | ||
environment: | ||
CALLBACKS_ENABLED: trace | ||
TRACE_OUTPUT_DIR: /ansible_collections/mhansen/ansible-trace | ||
TRACE_HIDE_TASK_ARGUMENTS: True | ||
tasks: | ||
- name: Random task | ||
shell: "echo 'Hello world'" | ||
|
||
- name: Nested play | ||
import_playbook: otherplays.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
- hosts: group_a | ||
name: Random play | ||
environment: | ||
CALLBACKS_ENABLED: trace | ||
TRACE_OUTPUT_DIR: /ansible_collections/mhansen/ansible-trace | ||
TRACE_HIDE_TASK_ARGUMENTS: True | ||
tasks: | ||
- name: A fake task | ||
shell: "echo 'hello there'" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Handle integration tests | ||
from typing import Union, Dict, List, Any | ||
from utils import get_last_trace, parse_and_validate_trace | ||
from event import HostEvent | ||
import pytest | ||
|
||
JSONTYPE = Union[None, int, str, bool, List[Any], Dict[str, Any]] | ||
|
||
|
||
@pytest.mark.ansible_playbook('plays/base.yml') | ||
@pytest.mark.ansible_inventory('inventories/multiple_hosts.ini') | ||
@pytest.mark.ansible_strategy('free') | ||
def test_basic_multiple_free(ansible_play): | ||
trace_hosts: Dict[int, HostEvent] | ||
trace_events: Dict[int, Any] | ||
trace_json: JSONTYPE = get_last_trace() | ||
trace_hosts, trace_events = parse_and_validate_trace(trace_json) | ||
|
||
|
||
@pytest.mark.ansible_playbook('plays/base.yml') | ||
@pytest.mark.ansible_inventory('inventories/multiple_hosts.ini') | ||
@pytest.mark.ansible_strategy('linear') | ||
def test_basic_multiple_linear(ansible_play): | ||
trace_hosts: Dict[int, HostEvent] | ||
trace_events: Dict[int, Any] | ||
trace_json: JSONTYPE = get_last_trace() | ||
trace_hosts, trace_events = parse_and_validate_trace(trace_json) | ||
|
||
|
||
@pytest.mark.ansible_playbook('plays/base.yml') | ||
@pytest.mark.ansible_inventory('inventories/one_host.ini') | ||
@pytest.mark.ansible_strategy('linear') | ||
def test_basic_single_linear(ansible_play): | ||
trace_hosts: Dict[int, HostEvent] | ||
trace_events: Dict[int, Any] | ||
trace_json: JSONTYPE = get_last_trace() | ||
trace_hosts, trace_events = parse_and_validate_trace(trace_json) |