From 4f0a9488bbe9eb4d5fbcee49ca858bd1f71ed57a Mon Sep 17 00:00:00 2001
From: David Shrewsbury <Shrews@users.noreply.github.com>
Date: Tue, 4 May 2021 11:41:02 -0400
Subject: [PATCH] [coverage] improve test coverage for indexed_items lookup
 (#74548)

---
 .../targets/lookup_indexed_items/tasks/main.yml  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/integration/targets/lookup_indexed_items/tasks/main.yml b/test/integration/targets/lookup_indexed_items/tasks/main.yml
index 84f5fbce972..434fe0ff84d 100644
--- a/test/integration/targets/lookup_indexed_items/tasks/main.yml
+++ b/test/integration/targets/lookup_indexed_items/tasks/main.yml
@@ -14,3 +14,19 @@
         - "x2 == 'set'"
         - "x3 == 'set'"
         - "x4 == 'set'"
+
+- block:
+    - name: "EXPECTED FAILURE - test not a list"
+      debug:
+        msg: "{{ item.0 }} is {{ item.1 }}"
+      with_indexed_items:
+        "a": 1
+
+    - fail:
+        msg: "should not get here"
+
+  rescue:
+    - assert:
+        that:
+          - ansible_failed_task.name == "EXPECTED FAILURE - test not a list"
+          - ansible_failed_result.msg == "with_indexed_items expects a list"