Mercurial > hg
annotate tests/test-chg.t @ 31975:76169296e52f
obsolescence: add test for the "branch replacement" logic during push, case A2
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.
The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.
See inline documentation for details about the test case added in this
changeset.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 13 Apr 2017 16:23:01 +0200 |
parents | ca7af5d15b21 |
children | 46ba2cdda476 |
rev | line source |
---|---|
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
1 #require chg |
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
2 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
3 $ cp $HGRCPATH $HGRCPATH.orig |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
4 |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
5 init repo |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
6 |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
7 $ chg init foo |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
8 $ cd foo |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
9 |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
10 ill-formed config |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
11 |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
12 $ chg status |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
13 $ echo '=brokenconfig' >> $HGRCPATH |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
14 $ chg status |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
15 hg: parse error at * (glob) |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
16 [255] |
29088 | 17 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
18 $ cp $HGRCPATH.orig $HGRCPATH |
30677 | 19 |
20 long socket path | |
21 | |
22 $ sockpath=$TESTTMP/this/path/should/be/longer/than/one-hundred-and-seven/characters/where/107/is/the/typical/size/limit/of/unix-domain-socket | |
23 $ mkdir -p $sockpath | |
24 $ bakchgsockname=$CHGSOCKNAME | |
25 $ CHGSOCKNAME=$sockpath/server | |
26 $ export CHGSOCKNAME | |
27 $ chg root | |
28 $TESTTMP/foo | |
29 $ rm -rf $sockpath | |
30 $ CHGSOCKNAME=$bakchgsockname | |
31 $ export CHGSOCKNAME | |
32 | |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
33 $ cd .. |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
34 |
31107
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
35 editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
36 ------ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
37 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
38 $ cat >> pushbuffer.py <<EOF |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
39 > def reposetup(ui, repo): |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
40 > repo.ui.pushbuffer(subproc=True) |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
41 > EOF |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
42 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
43 $ chg init editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
44 $ cd editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
45 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
46 by default, system() should be redirected to the client: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
47 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
48 $ touch foo |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
49 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
50 > | egrep "HG:|run 'cat" |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
51 chg: debug: run 'cat "*"' at '$TESTTMP/editor' (glob) |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
52 HG: Enter commit message. Lines beginning with 'HG:' are removed. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
53 HG: Leave message empty to abort commit. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
54 HG: -- |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
55 HG: user: test |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
56 HG: branch 'default' |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
57 HG: added foo |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
58 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
59 but no redirection should be made if output is captured: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
60 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
61 $ touch bar |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
62 $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
63 > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
64 > | egrep "HG:|run 'cat" |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
65 [1] |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
66 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
67 check that commit commands succeeded: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
68 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
69 $ hg log -T '{rev}:{desc}\n' |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
70 1:bufferred |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
71 0:channeled |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
72 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
73 $ cd .. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
74 |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
75 pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
76 ----- |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
77 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
78 $ cat >> fakepager.py <<EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
79 > import sys |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
80 > for line in sys.stdin: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
81 > sys.stdout.write('paged! %r\n' % line) |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
82 > EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
83 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
84 enable pager extension globally, but spawns the master server with no tty: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
85 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
86 $ chg init pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
87 $ cd pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
88 $ cat >> $HGRCPATH <<EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
89 > [extensions] |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
90 > pager = |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
91 > [pager] |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
92 > pager = python $TESTTMP/fakepager.py |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
93 > EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
94 $ chg version > /dev/null |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
95 $ touch foo |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
96 $ chg ci -qAm foo |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
97 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
98 pager should be enabled if the attached client has a tty: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
99 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
100 $ chg log -l1 -q --config ui.formatted=True |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
101 paged! '0:1f7b0de80e11\n' |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
102 $ chg log -l1 -q --config ui.formatted=False |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
103 0:1f7b0de80e11 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
104 |
31890 | 105 chg waits for pager if runcommand raises |
106 | |
107 $ cat > $TESTTMP/crash.py <<EOF | |
108 > from mercurial import cmdutil | |
109 > cmdtable = {} | |
110 > command = cmdutil.command(cmdtable) | |
111 > @command('crash') | |
112 > def pagercrash(ui, repo, *pats, **opts): | |
113 > ui.write('going to crash\n') | |
114 > raise Exception('.') | |
115 > EOF | |
116 | |
117 $ cat > $TESTTMP/fakepager.py <<EOF | |
118 > import sys, time | |
119 > for line in iter(sys.stdin.readline, ''): | |
120 > if 'crash' in line: # only interested in lines containing 'crash' | |
121 > # if chg exits when pager is sleeping (incorrectly), the output | |
122 > # will be captured by the next test case | |
123 > time.sleep(1) | |
124 > sys.stdout.write('crash-pager: %s' % line) | |
125 > EOF | |
126 | |
127 $ cat >> .hg/hgrc <<EOF | |
128 > [extensions] | |
129 > crash = $TESTTMP/crash.py | |
130 > EOF | |
131 | |
132 $ chg crash --pager=on --config ui.formatted=True 2>/dev/null | |
133 crash-pager: going to crash | |
134 [255] | |
135 | |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
136 $ cd .. |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
137 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
138 server lifecycle |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
139 ---------------- |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
140 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
141 chg server should be restarted on code change, and old server will shut down |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
142 automatically. In this test, we use the following time parameters: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
143 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
144 - "sleep 1" to make mtime different |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
145 - "sleep 2" to notice mtime change (polling interval is 1 sec) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
146 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
147 set up repository with an extension: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
148 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
149 $ chg init extreload |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
150 $ cd extreload |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
151 $ touch dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
152 $ cat <<EOF >> .hg/hgrc |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
153 > [extensions] |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
154 > dummyext = dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
155 > EOF |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
156 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
157 isolate socket directory for stable result: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
158 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
159 $ OLDCHGSOCKNAME=$CHGSOCKNAME |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
160 $ mkdir chgsock |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
161 $ CHGSOCKNAME=`pwd`/chgsock/server |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
162 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
163 warm up server: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
164 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
165 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
30620
937c52f06709
chg: start server at a unique address
Jun Wu <quark@fb.com>
parents:
29343
diff
changeset
|
166 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
167 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
168 new server should be started if extension modified: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
169 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
170 $ sleep 1 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
171 $ touch dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
172 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
173 chg: debug: instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
174 chg: debug: instruction: reconnect |
30620
937c52f06709
chg: start server at a unique address
Jun Wu <quark@fb.com>
parents:
29343
diff
changeset
|
175 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
176 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
177 old server will shut down, while new server should still be reachable: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
178 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
179 $ sleep 2 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
180 $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
181 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
182 socket file should never be unlinked by old server: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
183 (simulates unowned socket by updating mtime, which makes sure server exits |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
184 at polling cycle) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
185 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
186 $ ls chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
187 chgsock/server-* (glob) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
188 $ touch chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
189 $ sleep 2 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
190 $ ls chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
191 chgsock/server-* (glob) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
192 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
193 since no server is reachable from socket file, new server should be started: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
194 (this test makes sure that old server shut down automatically) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
195 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
196 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
30620
937c52f06709
chg: start server at a unique address
Jun Wu <quark@fb.com>
parents:
29343
diff
changeset
|
197 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
198 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
199 shut down servers and restore environment: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
200 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
201 $ rm -R chgsock |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
202 $ CHGSOCKNAME=$OLDCHGSOCKNAME |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
203 $ cd .. |