git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] remote-curl: add testing for intelligent retry for HTTP

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 13, 2020, 14:25 UTC
Message-ID
<nycvar.QRO.7.76.6.2010131624060.50@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqd01nm60u.fsf@gitster.c.googlers.com>
Hi Junio,
On Mon, 12 Oct 2020, Junio C Hamano wrote:
Show 32 quoted lines
> 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.

We should also consider using `test-tool genrandom <seed>` instead (where `<seed>` would have to be predictable, but probably would have to change between `gen_nonce()` calls).

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 13 in “replace CURLOPT_FILE With CURLOPT_WRITEDATA”
  1. 2/3 replace CURLOPT_FILE With CURLOPT_WRITEDATASean McAllister, Oct 12, 2020
  2. Johannes SchindelinOct 12, 2020
  3. 3/3 http: automatically retry some requestsSean McAllister, Oct 12, 2020
  4. Johannes SchindelinOct 12, 2020
  5. Junio C HamanoOct 12, 2020
  6. Sean McAllisterOct 13, 2020
  7. Junio C HamanoOct 13, 2020
  8. remote-curl: add testing for intelligent retry for HTTPSean McAllister, Oct 12, 2020
  9. Junio C HamanoOct 12, 2020
  10. Sean McAllisterOct 12, 2020
  11. Junio C HamanoOct 12, 2020
  12. Johannes SchindelinOct 13, 2020
  13. Junio C HamanoOct 13, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.