annotate tests/test-contrib-pull-logger.t @ 51461:47752632b4fc

branchcache: rename `load` to `_load_heads` We are about to have more similar function, we rename the existing one to a more meaningful name and mark it private in the process.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 26 Feb 2024 15:12:20 +0100
parents 946c023212b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49508
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
1 Check that the pull logger plugins logs pulls
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
2 =============================================
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
3
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
4 Enable the extension
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
5
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
6 $ echo "[extensions]" >> $HGRCPATH
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
7 $ echo "pull-logger = $TESTDIR/../contrib/pull_logger.py" >> $HGRCPATH
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
8
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
9
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
10 Check the format of the generated log entries, with a bunch of elements in the
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
11 common and heads set
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
12
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
13 $ hg init server
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
14 $ hg -R server debugbuilddag '.*2+2'
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
15 $ hg clone ssh://user@dummy/server client --rev 0
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
16 adding changesets
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
17 adding manifests
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
18 adding file changes
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
19 added 1 changesets with 0 changes to 0 files
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
20 new changesets 1ea73414a91b
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
21 updating to branch default
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
22 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
23 $ tail -1 server/.hg/pull_log.jsonl
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
24 {"common": ["0000000000000000000000000000000000000000"], "heads": ["1ea73414a91b0920940797d8fc6a11e447f8ea1e"], "logger_version": 0, "timestamp": *} (glob)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
25 $ hg -R client pull --rev 1 --rev 2
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
26 pulling from ssh://user@dummy/server
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
27 searching for changes
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
28 adding changesets
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
29 adding manifests
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
30 adding file changes
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
31 added 2 changesets with 0 changes to 0 files (+1 heads)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
32 new changesets d8736c3a2c84:fa28e81e283b
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
33 (run 'hg heads' to see heads, 'hg merge' to merge)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
34 $ tail -1 server/.hg/pull_log.jsonl
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
35 {"common": ["1ea73414a91b0920940797d8fc6a11e447f8ea1e"], "heads": ["d8736c3a2c84ee759a2821385804bcb67f266ade", "fa28e81e283b3416de4d48ee0dd2d446e9e38d7c"], "logger_version": 0, "timestamp": *} (glob)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
36 $ hg -R client pull --rev 2 --rev 3
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
37 pulling from ssh://user@dummy/server
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
38 searching for changes
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
39 adding changesets
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
40 adding manifests
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
41 adding file changes
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
42 added 1 changesets with 0 changes to 0 files
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
43 new changesets 944641ddcaef
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
44 (run 'hg update' to get a working copy)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
45 $ tail -1 server/.hg/pull_log.jsonl
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
46 {"common": ["1ea73414a91b0920940797d8fc6a11e447f8ea1e", "fa28e81e283b3416de4d48ee0dd2d446e9e38d7c"], "heads": ["944641ddcaef174df7ce1bc2751a5f165129778b", "fa28e81e283b3416de4d48ee0dd2d446e9e38d7c"], "logger_version": 0, "timestamp": *} (glob)
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
47
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
48
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
49 Check the number of entries generated in the log when pulling from multiple
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
50 clients at the same time
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
51
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
52 $ rm -f server/.hg/pull_log.jsonl
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
53 $ for i in $($TESTDIR/seq.py 32); do
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
54 > hg clone ssh://user@dummy/server client_$i --rev 0
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
55 > done > /dev/null
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
56 $ for i in $($TESTDIR/seq.py 32); do
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
57 > hg -R client_$i pull --rev 1 &
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
58 > done > /dev/null
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
59 $ wait
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
60 $ wc -l server/.hg/pull_log.jsonl
791050360486 contrib: add pull_logger extension
pacien <pacien.trangirard@pacien.net>
parents:
diff changeset
61 \s*64 .* (re)
49509
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
62
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
63
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
64 Test log rotation when reaching some size threshold
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
65
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
66 $ cat >> $HGRCPATH << EOF
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
67 > [pull-logger]
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
68 > rotate-size = 1kb
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
69 > EOF
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
70
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
71 $ rm -f server/.hg/pull_log.jsonl
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
72 $ for i in $($TESTDIR/seq.py 10); do
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
73 > hg -R client pull --rev 1
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
74 > done > /dev/null
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
75 $ wc -l server/.hg/pull_log.jsonl
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
76 \s*3 .* (re)
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
77 $ wc -l server/.hg/pull_log.jsonl.rotated
946c023212b8 pull_logger: add basic log file rotation based on size
pacien <pacien.trangirard@pacien.net>
parents: 49508
diff changeset
78 \s*7 .* (re)