File: __driver__.lua

package info (click to toggle)
monotone 1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,984 kB
  • ctags: 8,622
  • sloc: cpp: 86,450; sh: 6,906; perl: 924; makefile: 813; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (59 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
includecommon("netsync.lua")

mtn_setup()
netsync.setup()
append("netsync.lua", "\
\
includedirpattern(get_confdir() .. \"/hooks.d\",\"*.conf\")\
includedirpattern(get_confdir() .. \"/hooks.d\",\"*.lua\")\
")
mkdir("hooks.d")

-- the server that shall receive the push from the other server
srv1 = netsync.start(2)
sleep(5)

-- the server that shall push to the other server.  We add this
-- hook now, so the former server doesn't catch it
check(copy(srcdir.."/../extra/mtn-hooks/monotone-cluster-push.lua",
	   "hooks.d/monotone-cluster-push.lua"))
writefile("hooks.d/monotone-cluster-push.conf",
	  "MCP_debug = true\nMCP_verbose_startup=true\n")
writefile("cluster-push.rc",
	  "\
pattern \"*\"\
server \""..srv1.address.."\"\n")
srv2 = netsync.start(3)
sleep(5)

-- Move the hook, so we don't confuse the clients
rename("hooks.d/monotone-cluster-push.conf",
       "hooks.d/monotone-cluster-push.conf.disabled")
rename("hooks.d/monotone-cluster-push.lua",
       "hooks.d/monotone-cluster-push.lua.disabled")

-- Now, send something to the second server
addfile("foo", "bar")
commit()
srv2:push("testbranch",1)
pushed_rev=base_revision()
sleep(5)

-- Destroy the client setup and rebuild it, so we can pull frmo scratch
remove("test.db")
remove("_MTN")
mtn_setup()

-- Now, fetch from the first server
srv1:pull("testbranch",1)
check(mtn("checkout", "--branch=testbranch", "checkout"), 0, false, false)
savedir = chdir("checkout")
pulled_rev=base_revision()
chdir(savedir)

-- Check that the revisions are the same
check(pushed_rev == pulled_rev)

-- Cleanup
srv1:stop()
srv2:stop()