##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r48732:9c4204b7 default
r53365:4ef6dbc2 default
Show More
test-transaction-rollback-on-sigpipe.t
80 lines | 2.6 KiB | text/troff | Tads3Lexer
/ tests / test-transaction-rollback-on-sigpipe.t
Valentin Gatien-Baron
test: remove some unnecessary dependency on repo format...
r48087 Test that, when an hg push is interrupted and the remote side receives SIGPIPE,
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328 the remote hg is able to successfully roll back the transaction.
$ hg init -q remote
Valentin Gatien-Baron
tests: rely on dummyssh being the default...
r48732 $ hg clone -q ssh://user@dummy/`pwd`/remote local
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 $ SIGPIPE_REMOTE_DEBUG_FILE="$TESTTMP/DEBUGFILE"
$ SYNCFILE1="$TESTTMP/SYNCFILE1"
$ SYNCFILE2="$TESTTMP/SYNCFILE2"
$ export SIGPIPE_REMOTE_DEBUG_FILE
$ export SYNCFILE1
$ export SYNCFILE2
$ PYTHONUNBUFFERED=1
$ export PYTHONUNBUFFERED
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328
On the remote end, run hg, piping stdout and stderr through processes that we
know the PIDs of. We will later kill these to simulate an ssh client
disconnecting.
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 $ remotecmd="$RUNTESTDIR/testlib/sigpipe-remote.py"
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328
In the pretxnchangegroup hook, kill the PIDs recorded above to simulate ssh
disconnecting. Then exit nonzero, to force a transaction rollback.
$ cat >remote/.hg/hgrc <<EOF
> [hooks]
test-sigpipe: run the hook using `sh`...
r48415 > pretxnchangegroup.00-break-things=sh "$RUNTESTDIR/testlib/wait-on-file" 10 "$SYNCFILE2" "$SYNCFILE1"
test: make sure we hit the SIGPIPE in test-transaction-rollback-on-sigpipe...
r48351 > pretxnchangegroup.01-output-things=echo "some remote output to be forward to the closed pipe"
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418 > pretxnchangegroup.02-output-things=echo "some more remote output"
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328 > EOF
test: clarify some output in `test-transaction-rollback-on-sigpipe`...
r48350 $ hg --cwd ./remote tip -T '{node|short}\n'
000000000000
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328 $ cd local
$ echo foo > foo ; hg commit -qAm "commit"
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418
(use quiet to avoid flacky output from the server)
Valentin Gatien-Baron
tests: rely on dummyssh being the default...
r48732 $ hg push --quiet --remotecmd "$remotecmd"
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328 abort: stream ended unexpectedly (got 0 bytes, expected 4)
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 [255]
$ cat $SIGPIPE_REMOTE_DEBUG_FILE
SIGPIPE-HELPER: Starting
SIGPIPE-HELPER: Redirection in place
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418 SIGPIPE-HELPER: pipes closed in main
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 SIGPIPE-HELPER: SYNCFILE1 detected
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418 SIGPIPE-HELPER: worker killed
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 SIGPIPE-HELPER: creating SYNCFILE2
SIGPIPE-HELPER: Shutting down
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418 SIGPIPE-HELPER: Server process terminated with status 255 (no-windows !)
SIGPIPE-HELPER: Server process terminated with status 1 (windows !)
test: use a python script in `test-transaction-rollback-on-sigpipe.t`...
r48352 SIGPIPE-HELPER: Shut down
Mitchell Plamann
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression...
r46328
Valentin Gatien-Baron
test: remove some unnecessary dependency on repo format...
r48087 The remote should be left in a good state
test: clarify some output in `test-transaction-rollback-on-sigpipe`...
r48350 $ hg --cwd ../remote tip -T '{node|short}\n'
000000000000
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418
#if windows
XXX-Windows Broken behavior to be fixed
Behavior on Windows is broken and should be fixed. However this is a fairly
corner case situation and no data are being corrupted. This would affect
central repository being hosted on a Windows machine and accessed using ssh.
This was catch as we setup new CI for Windows. Making the test pass on Windows
was enough of a pain that fixing the behavior set aside for now. Dear and
honorable reader, feel free to fix it.
$ hg --cwd ../remote recover
rolling back interrupted transaction
(verify step skipped, run `hg verify` to check your repository content)
#else
Valentin Gatien-Baron
test: remove some unnecessary dependency on repo format...
r48087 $ hg --cwd ../remote recover
no interrupted transaction available
Mitchell Plamann
hook: ignore EPIPE when flushing stdout/stderr...
r46329 [1]
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill...
r48418
#endif