Some more coverage for csvfile (#70661)

* Some more coverage for csvfile

Change:
- Add a few tests

Test Plan:
- CI, new tests

Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
Rick Elrod 2020-07-15 14:44:52 -05:00 committed by GitHub
parent 02c63ec285
commit 8455bc6838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: