aboutsummaryrefslogtreecommitdiff
path: root/integration/run
blob: d3ae6ce8b79eb01a0986688c0ca82233204e3568 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

#
# You will need to configure Trillian locally on your test machine.  See
#
#     cmd/sigsum_log_go/README.md.
#
# for some pointers.  Ensure that trillian_log_server and trillian_log_signer
# are in $GOPATH, and set the appropriate Trillian id in start_sigsum_server.
#
# You will also need to install into your $GOPATH:
#
#     go build -o $GOPATH/bin/sigsum_log_go cmd/sigsum_log_go/main.go
#     go build -o $GOPATH/bin/sigsum_keygen cmd/tmp/keygen/main.go
#     go build -o $GOPATH/bin/cosign cmd/tmp/cosign/main.go
#     go build -o $GOPATH/bin/submit cmd/tmp/submit/main.go
#
# Run the test as follows:
#
#     1. integration/start_tlog_seq     # "terminal 1"
#     2. integration/start_tlog_serv    # "terminal 2"
#     3. integration/start_sigsum_serv  # "terminal 3"
#     4. integration/run                # "terminal 4"
#
# What you expect to see is if the different endpoints function.
#
#     - There is a to-cosign tree head
#     - Submitting four entries work
#     - Adding a cosignature works
#     - Cosigned tree head is not available (waiting for rotate)
#     - Experimental checkpoint works
#     - Consistency proof works
#     - Fetching entries work
#     - Cosigned tree head is available (tree heads rotated)
#
# Warning: it is assumed that there are at least 4 leaves in the database.
# Warning: the get-inclusion-proof endpoint is not poked.
# Warning: this needs to be replaced, see issues/add-integration-test.md.
#

. "$(dirname $0)/config"

now=$(date +%s)
url=http://localhost:6965/testonly/sigsum/v0
shard_hint=$(date +%s)

wait_seconds=5

echo "test: get-tree-head-to-sign"
curl $url/get-tree-head-to-sign
sleep $wait_seconds; echo ""

echo "test: submitting four..."
$GOPATH/bin/submit --sk=$submit_sk --shard_hint=$shard_hint --domain_hint=$domain_hint | bash
sleep $wait_seconds

echo "test: cosigning..."
$GOPATH/bin/cosign --url=$url --log_vk=$log_vk --sk=$wit_sk
sleep $wait_seconds
echo ""

echo "test: get-tree-head-cosigned (expect failure on first run with new log)"
curl $url/get-tree-head-cosigned
sleep $wait_seconds
echo ""

echo "test: get-checkpoint"
curl $url/get-checkpoint
sleep $wait_seconds
echo ""

echo "test: get-consistency-proof (expect failure on first run with new log)"
printf "old_size=1\nnew_size=4\n" | curl --data-binary @- $url/get-consistency-proof
sleep $wait_seconds
echo ""

echo "test: get-leaves (first and second)"
printf "start_size=0\nend_size=1\n" | curl --data-binary @- $url/get-leaves
sleep $wait_seconds
echo ""

echo "with 30s interval we should now have a cosigned tree head (might fail on first run with new log)"
curl $url/get-tree-head-cosigned
echo ""