Skip to content

Commit

Permalink
update hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Nov 25, 2022
1 parent 74e93bf commit 494f351
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
17 changes: 9 additions & 8 deletions docs/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,22 @@ playbook.yml \
Here is the output:

```
PLAY [Testing play] ************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Starting Monkeyble callback
PLAY [play1] *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
🐵 Starting Monkeyble callback
monkeyble_scenario: validate_test_1
Monkeyble scenario: Monkeyble hello world
TASK [debug task] **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
{'monkeyble_passed_test': [{'test_name': 'assert_equal', 'tested_value': 'Hello Monkeyble', 'expected': 'Hello Monkeyble'}], 'monkeyble_failed_test': []}
🙈 Monkeyble test input passed ✔
{"monkeyble_passed_test": [{"test_name": "assert_equal", "tested_value": "Hello Monkeyble", "expected": "Hello Monkeyble"}], "monkeyble_failed_test": []}
ok: [localhost] => {
"msg": "Hello Monkeyble"
}
PLAY RECAP *********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Monkeyble - ALL TESTS PASSED - scenario: Monkeyble hello world
🐵 Monkeyble - ALL TESTS PASSED - scenario: Monkeyble hello world
```

The debug module has been well called with the expected argument value. The test passed. The return code on stderr is `0`.
Expand All @@ -67,14 +68,14 @@ Let's change the test to make it fail. We update the executed task and change th

We execute the playbook the same way. The result is now the following:
```
PLAY [Testing play] ************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Starting Monkeyble callback
PLAY [play1] *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
🐵 Starting Monkeyble callback
monkeyble_scenario: validate_test_1
Monkeyble scenario: Monkeyble hello world
TASK [debug task] **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Monkeyble failed scenario: Monkeyble hello world
{'monkeyble_passed_test': [], 'monkeyble_failed_test': [{'test_name': 'assert_equal', 'tested_value': 'Goodbye Monkeyble', 'expected': 'Hello Monkeyble'}]}
🙊 Monkeyble failed scenario: Monkeyble hello world
{"monkeyble_passed_test": [], "monkeyble_failed_test": [{"test_name": "assert_equal", "tested_value": "Goodbye Monkeyble", "expected": "Hello Monkeyble"}]}
```

This time the test has failed. The return code on stderr is `1`.
5 changes: 5 additions & 0 deletions tests/monkeyble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ monkeyble_scenarios:
validate_test_1:
name: "Monkeyble hello world"
tasks_to_test:
- task: "debug task"
test_input:
- assert_equal:
arg_name: msg
expected: "Hello Monkeyble"
# - task: "task1"
# mock:
# config:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
vars:
my_var: "Hello Monkeyble"
tasks:
- name: "task1"
- name: "debug task"
debug:
msg: "{{ my_var }}"
msg: "Goodbye Monkeyble"

# - name: "task2"
# debug:
Expand Down

0 comments on commit 494f351

Please sign in to comment.