git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Sean McAllister <smcallis@google.com>
Cc: git@vger.kernel.org, peff@peff.net, masayasuzuki@google.com
Subject: Re: [PATCH] remote-curl: add testing for intelligent retry for HTTP
Date: Mon, 12 Oct 2020 15:30:25 -0700	[thread overview]
Message-ID: <xmqqd01nm60u.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <CAM4o00e4wYOHkn38H8UwqboRMSzAs4QCvTN6Ef6PuUnYfwOoXg@mail.gmail.com> (Sean McAllister's message of "Mon, 12 Oct 2020 16:20:49 -0600")

Sean McAllister <smcallis@google.com> writes:

>> Sean McAllister <smcallis@google.com> writes:
>>
>> > +# generate a random 12 digit string
>> > +gen_nonce() {
>> > +    test_copy_bytes 12 < /dev/urandom | tr -dc A-Za-z0-9
>> > +}
>>
>> What is the randomness requirement of this application?  IOW, what
>> breaks if we just change this to "echo 0123456789ab"?
>>
>> Or "date | git hash-object --stdin" for that matter?
>>
>> We'd want to make our tests more predictiable, not less.
>
> The randomness requirement is just that I need nonces to be unique
> during a single run of the HTTP server
> as they uniquefy the files I put on disk to make the HTTP hack-ily
> stateful.  I'd be fine with your date/hash-object
> solution, but I don't know that it will help make the tests more predictable.

If so, would something like this be

    global_counter_for_nonce=0
    gen_nonce () {
	global_counter_for_nonce=$(( global_counter_for_nonce + 1 )) &&
	echo "$global_counter_for_nonce"
    }

more appropriate?  It is utterly predictable and yields the same
answer only once during a single run.

  reply	other threads:[~2020-10-12 22:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201012184806.166251-1-smcallis@google.com>
2020-10-12 18:48 ` [PATCH 2/3] replace CURLOPT_FILE With CURLOPT_WRITEDATA Sean McAllister
2020-10-12 19:26   ` Johannes Schindelin
2020-10-12 18:48 ` [PATCH 3/3] http: automatically retry some requests Sean McAllister
2020-10-12 20:15   ` Johannes Schindelin
2020-10-12 21:00     ` Junio C Hamano
2020-10-13 15:03     ` Sean McAllister
2020-10-13 17:45       ` Junio C Hamano
2020-10-12 20:19 ` [PATCH] remote-curl: add testing for intelligent retry for HTTP Sean McAllister
2020-10-12 20:51   ` Junio C Hamano
2020-10-12 22:20     ` Sean McAllister
2020-10-12 22:30       ` Junio C Hamano [this message]
2020-10-13 14:25         ` Johannes Schindelin
2020-10-13 17:29           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd01nm60u.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=masayasuzuki@google.com \
    --cc=peff@peff.net \
    --cc=smcallis@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).