From 29a60e261cb65ac7c5d9c6c750d2ab13aecd2d8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= <goneri@lebouder.net>
Date: Fri, 16 Sep 2022 13:40:06 -0400
Subject: [PATCH] tests/acm_certificate: retries a aws_acm_info if needed
 (#1473)

tests/acm_certificate: retries aws_acm_info called when needed

The aws_acm_info may return an empty list if a certificate has just been recreated (race condition). We now retry 3 times until we've got a list.

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: https://github.com/ansible-collections/community.aws/commit/c7510c2c869b96a7a35ccc77c54a0007b29ebb67
---
 tests/integration/targets/acm_certificate/tasks/main.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/integration/targets/acm_certificate/tasks/main.yml b/tests/integration/targets/acm_certificate/tasks/main.yml
index 118fca74498..bf70587e67e 100644
--- a/tests/integration/targets/acm_certificate/tasks/main.yml
+++ b/tests/integration/targets/acm_certificate/tasks/main.yml
@@ -505,6 +505,8 @@
       tags:
         Name: '{{ chained_cert.name }}'
     register: check_chain
+    until: check_chain.certificates|length > 0
+    retries: 3
   - name: check chain of cert we just uploaded
     assert:
       that:
@@ -545,6 +547,8 @@
       tags:
         Name: '{{ chained_cert.name }}'
     register: check_chain_2
+    until: check_chain_2.certificates|length > 0
+    retries: 3
   - name: check chain of cert we just uploaded
     assert:
       that: