Skip to content

Commit

Permalink
fix(tests) allow to try infinitely for bad nonce in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Sep 19, 2021
1 parent c129b3f commit 0170c6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/resty/acme/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ end

local wait_backoff_series = {1, 1, 2, 3, 5, 8, 13, 21}

local TEST_TRY_NONCE_INFINITELY = not not os.getenv("TEST_TRY_NONCE_INFINITELY")

local _M = {
_VERSION = '0.7.2'
}
Expand Down Expand Up @@ -313,7 +315,7 @@ function _M:post(url, payload, headers, nonce)
if not nonce then
log(ngx_WARN, "bad nonce: recoverable error, retrying")
return self:post(url, payload, headers, resp.headers["Replay-Nonce"])
else
elseif not TEST_TRY_NONCE_INFINITELY then
return nil, nil, "bad nonce: failed again, bailing out"
end
else
Expand Down
2 changes: 2 additions & 0 deletions t/e2e.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use Cwd qw(cwd);

my $pwd = cwd();

env_to_nginx("TEST_TRY_NONCE_INFINITELY=1");

$ENV{'tm'} = time;

sub ::make_http_config{
Expand Down

0 comments on commit 0170c6d

Please sign in to comment.