monotone

monotone Mtn Source Tree

Root/tests/t_nntp.at

1# -*- Autoconf -*-
2
3# this script uses the 'sn' news server and the 'tcpserver' network package
4# from ucspi-tcp. if you do not have them installed, it will fail.
5
6AT_SETUP([communicating with a news server])
7
8MONOTONE_SETUP
9AT_CHECK(cp test.db test2.db)
10
11AT_DATA(nntp.lua, [
12function get_post_targets(branchname)
13return { "nntp://127.0.0.1:8119/monotone.test.packets" }
14end
15
16function get_fetch_sources(branchname)
17return { "nntp://127.0.0.1:8119/monotone.test.packets" }
18end
19
20function get_news_sender(url)
21return "tester@test.net"
22end
23])
24
25AT_DATA(testfile, [version 0 of test file
26])
27AT_CHECK(MONOTONE add testfile, [], [ignore], [ignore])
28AT_CHECK(MONOTONE --branch=testbranch --rcfile=nntp.lua commit blah-blah, [], [ignore], [ignore])
29VER0=`SHA1(MT/manifest)`
30
31AT_DATA(testfile, [version 1 of test file
32])
33AT_CHECK(MONOTONE --rcfile=nntp.lua commit blah-blah, [], [ignore], [ignore])
34VER1=`SHA1(MT/manifest)`
35
36
37# silly bug: sn has a name clash with libwww-perl so I have had to install
38# them in different locations. this is nuts.
39export PATH=/usr/local/sbin:$PATH
40export SNROOT=`pwd`/snroot
41export POSTING_OK=''
42PORT=8119
43HOST=127.0.0.1
44GROUP=monotone.test.packets
45TCPSERVER=`which tcpserver`
46SNNTPD=`which snntpd`
47
48# if no tcpserver or snntpd, skip the test
49if test -z "$TCPSERVER" || test -z "$SNNTPD"; then
50 exit 77
51fi
52
53AT_CHECK(test -x $TCPSERVER)
54AT_CHECK(test -x $SNNTPD)
55AT_CHECK(mkdir -p $SNROOT)
56AT_CHECK(snnewgroup $GROUP, [], [ignore], [ignore])
57
58# autotest knows no way of doing background processes
59
60AT_CHECK(cp $TCPSERVER ./nntp-test-tcpserver)
61AT_CHECK(chmod 0755 ./nntp-test-tcpserver)
62killall -q -TERM nntp-test-tcpserver
63./nntp-test-tcpserver -H -R -P -l 0 $HOST $PORT snntpd >/dev/null 2>&1 &
64sleep 2
65
66AT_CHECK(MONOTONE --rcfile=nntp.lua post, [], [ignore], [ignore])
67AT_CHECK(sncat $GROUP, [], [stdout])
68AT_CHECK(grep mdata stdout, [], [stdout])
69AT_CHECK(grep $VER0 stdout, [], [ignore])
70
71AT_CHECK(sncat $GROUP, [], [stdout])
72AT_CHECK(grep mdelta stdout, [], [stdout])
73AT_CHECK(grep $VER0 stdout, [], [ignore])
74
75AT_CHECK(sncat $GROUP, [], [stdout])
76AT_CHECK(grep $VER1 stdout, [], [ignore])
77
78AT_CHECK(MONOTONE --db=test2.db --rcfile=nntp.lua fetch nntp://127.0.0.1:8119/monotone.test.packets, [], [ignore], [ignore])
79
80AT_CHECK(MONOTONE --db=test2.db cat manifest $VER0, [], [stdout])
81AT_CHECK(grep testfile stdout, [], [ignore])
82
83AT_CHECK(MONOTONE --db=test2.db cat manifest $VER1, [], [stdout])
84AT_CHECK(grep testfile stdout, [], [ignore])
85
86AT_CHECK(MONOTONE --db=test2.db ls certs manifest $VER0, [], [stdout])
87AT_CHECK(mv stdout certs, [], [ignore])
88AT_CHECK(grep date certs, [], [ignore])
89AT_CHECK(grep author certs, [], [ignore])
90AT_CHECK(grep branch certs, [], [ignore])
91AT_CHECK(grep changelog certs, [], [ignore])
92AT_CHECK(grep bad certs, [1], [ignore])
93
94AT_CHECK(MONOTONE --db=test2.db ls certs manifest $VER1, [], [stdout])
95AT_CHECK(mv stdout certs, [], [ignore])
96AT_CHECK(grep date certs, [], [ignore])
97AT_CHECK(grep author certs, [], [ignore])
98AT_CHECK(grep branch certs, [], [ignore])
99AT_CHECK(grep changelog certs, [], [ignore])
100AT_CHECK(grep ancestor certs, [], [ignore])
101AT_CHECK(grep bad certs, [1], [ignore])
102
103killall -q -TERM nntp-test-tcpserver
104
105AT_CLEANUP

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status