sapling/eden/scm/tests/test-cats.t
Jan Mazur 32c57e97bf make test-cats less flaky
Summary: It used to be flaky. Perhaps ncat exited by itself in some cases so there was nothing to kill. Just ignore the kill command's output. As long as we get the cats header the test is fine.

Reviewed By: HarveyHunt

Differential Revision: D31108514

fbshipit-source-id: e2791610c49bacdc31c26710f087cbe49f4d734e
2021-09-22 04:52:06 -07:00

35 lines
1.0 KiB
Perl

#chg-compatible
#if no-windows
$ disable treemanifest
$ configure dummyssh
#require serve
#require bucktest
$ hg init test
$ cd test
$ echo foo>foo
$ hg addremove
adding foo
$ hg commit -m 1
$ hg verify
warning: verify does not actually check anything in this repo
$ cert="${HGTEST_CERTDIR}/localhost.crt"
$ cert_key="${HGTEST_CERTDIR}/localhost.key"
$ PROXY_PORT=1338
$ printf "HTTP/1.1 401 Unauthorized\r\n\r\n" | ncat -lkv --ssl-cert "$cert" --ssl-key "$cert_key" localhost "$PROXY_PORT" 1>/dev/null 2>/dev/null &
$ to_kill=$!
$ echo '{"crypto_auth_tokens": "cats"}' > cats
$ cats_file="$(pwd)/cats"
$ hg push --config http.verbose=True --config cats.some.priority=1 --config cats.some.path="$cats_file" --insecure --config paths.default=mononoke://localhost:$PROXY_PORT/test --config auth.mononoke.cert=$cert --config auth.mononoke.key=$cert_key --config auth.mononoke.prefix=mononoke://* 2> /dev/null | grep -o "x-forwarded-cats: cats"
x-forwarded-cats: cats
$ kill $to_kill 2>/dev/null
#endif