Skip to content

Commit 84207fe

Browse files
authored
test: Work around integration failures & flake (#8393)
- Avoid acme (python) 5.0.0, which removed acme.challenges.TLSALPN01 - Retry after badNonce errors Fixes #8385
1 parent 46013ea commit 84207fe

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
acme>=2.0
2-
cryptography>=0.7
1+
acme >= 2.0, < 5.0.0
2+
cryptography >= 0.7
33
PyOpenSSL
44
requests

test/chisel2.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,21 @@ def auth_and_issue(domains, chall_type="dns-01", email=None, cert_output=None, c
142142
else:
143143
raise Exception("invalid challenge type %s" % chall_type)
144144

145-
try:
146-
order = client.poll_and_finalize(order)
147-
if cert_output is not None:
148-
with open(cert_output, "w") as f:
149-
f.write(order.fullchain_pem)
150-
finally:
151-
cleanup()
145+
# Retry up to twice upon badNonce errors
146+
for n in range(2):
147+
try:
148+
order = client.poll_and_finalize(order)
149+
if cert_output is not None:
150+
with open(cert_output, "w") as f:
151+
f.write(order.fullchain_pem)
152+
except messages.Error as e:
153+
if e.typ == "urn:ietf:params:acme:error:badNonce":
154+
time.sleep(0.01)
155+
continue
156+
else:
157+
break
158+
finally:
159+
cleanup()
152160

153161
return order
154162

@@ -234,8 +242,15 @@ def expect_problem(problem_type, func):
234242
if len(domains) == 0:
235243
print(__doc__)
236244
sys.exit(0)
237-
try:
238-
auth_and_issue(domains)
239-
except messages.Error as e:
240-
print(e)
241-
sys.exit(1)
245+
# Retry up to twice upon badNonce errors
246+
for n in range(2):
247+
try:
248+
auth_and_issue(domains)
249+
except messages.Error as e:
250+
if e.typ == "urn:ietf:params:acme:error:badNonce":
251+
time.sleep(0.01)
252+
continue
253+
print(e)
254+
sys.exit(1)
255+
else:
256+
break

0 commit comments

Comments
 (0)