Skip to content

Commit

Permalink
Some more coverage for csvfile (ansible#70661)
Browse files Browse the repository at this point in the history
* Some more coverage for csvfile

Change:
- Add a few tests

Test Plan:
- CI, new tests

Signed-off-by: Rick Elrod <[email protected]>
  • Loading branch information
relrod authored Jul 15, 2020
1 parent 02c63ec commit 8455bc6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/integration/targets/lookup_csvfile/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
ignore_errors: yes
register: no_keyword

- set_fact:
this_will_error: "{{ lookup('csvfile', 'foo file=people.csv delimiter=, col=1 thisarg=doesnotexist') }}"
ignore_errors: yes
register: invalid_arg

- set_fact:
this_will_error: "{{ lookup('csvfile', 'foo file=doesnotexist delimiter=, col=1') }}"
ignore_errors: yes
register: missing_file

- name: Make sure we failed above
assert:
that:
- no_keyword is failed
- >
"Search key is required but was not found" in no_keyword.msg
- >
"not in paramvals" in invalid_arg.msg
- missing_file is failed
- >
"need string or buffer" in missing_file.msg or "expected str, bytes or os.PathLike object" in missing_file.msg
- name: Check basic comma-separated file
assert:
Expand Down

0 comments on commit 8455bc6

Please sign in to comment.