From 12675675563d3a33b37f56b5e79e933657565398 Mon Sep 17 00:00:00 2001 From: Ben Berry Date: Fri, 16 Jun 2017 03:22:20 -0700 Subject: [PATCH] Check sysctl no name (#25041) * add integration tests for no name on sysctl * better error validation, add test for no value --- .../integration/targets/sysctl/tasks/main.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/integration/targets/sysctl/tasks/main.yml b/test/integration/targets/sysctl/tasks/main.yml index 3aaf7972bde..ec6e7aad111 100644 --- a/test/integration/targets/sysctl/tasks/main.yml +++ b/test/integration/targets/sysctl/tasks/main.yml @@ -89,3 +89,31 @@ - 'sysctl_test2.changed is defined' - 'sysctl_test2.changed' - 'sysctl_check2.stdout_lines == ["net.ipv4.ip_forward = 1"]' + +- name: Try sysctl with no name + sysctl: + name: + value: 1 + sysctl_set: yes + ignore_errors: True + register: sysctl_no_name + +- name: validate nameless results + assert: + that: + - "sysctl_no_name|failed" + - "sysctl_no_name.msg == 'name can not be None'" + +- name: Try sysctl with no value + sysctl: + name: Foo + value: + sysctl_set: yes + ignore_errors: True + register: sysctl_no_value + +- name: validate nameless results + assert: + that: + - "sysctl_no_value|failed" + - "sysctl_no_value.msg == 'value can not be None'" \ No newline at end of file