File: __driver__.lua

package info (click to toggle)
monotone 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 20,708 kB
  • sloc: cpp: 84,765; sh: 6,787; perl: 837; makefile: 833; python: 517; lisp: 379; sql: 118; exp: 88; ansic: 52
file content (31 lines) | stat: -rw-r--r-- 863 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

includecommon("netsync.lua")
mtn_setup()
netsync.setup()

check(mtn("genkey", "foo@bar"), 0, false, false, "foo@bar\nfoo@bar\n")

-- Once to let the client note down the key...
-- We need to set the random seed, because each time a server is
-- started it picks a new random port.
seed = get_pid()
math.randomseed(seed)
netsync.pull("testbranch")

-- Then again with a different key; should fail.
math.randomseed(seed)
srv = netsync.start{"--key=foo@bar"}

srv:pull("testbranch", nil, 1)
-- It shouldn't have absorbed the key, either.
check(mtn2("pubkey", "foo@bar"), 1, true, false)

-- But if we then clear the client's known_hosts entry, it should be fine
check(mtn2("unset", "known-servers", srv.url), 0, false, false)

-- Now it should succeed
srv:pull("testbranch")
-- And have absorbed the key
check(mtn2("pubkey", "foo@bar"), 0, true, false)

srv:stop()