aboutsummaryrefslogtreecommitdiff
path: root/trillian_test.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-30 19:31:17 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-30 19:31:17 +0100
commitd2a37fc8afe359fc9bca6f5f67d9d976a8675803 (patch)
treebd2d2158878878b248f6f8aeb50efcdd4abf8e39 /trillian_test.go
parent317b64b20bb44c37f6aef0008e65b18ab806cd51 (diff)
made a few tests more robust and found error
Diffstat (limited to 'trillian_test.go')
-rw-r--r--trillian_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/trillian_test.go b/trillian_test.go
index 749f22a..179d03c 100644
--- a/trillian_test.go
+++ b/trillian_test.go
@@ -35,11 +35,11 @@ func TestCheckQueueLeaf(t *testing.T) {
},
{
description: "ok response: duplicate leaf",
- rsp: makeTrillianQueueLeafResponse(t, testPackage, testdata.RootChain, testdata.EndEntityPrivateKey, true),
+ rsp: makeTrillianQueueLeafResponse(t, testPackage, testdata.IntermediateChain, testdata.EndEntityPrivateKey, true),
},
{
description: "ok response: new leaf",
- rsp: makeTrillianQueueLeafResponse(t, testPackage, testdata.RootChain, testdata.EndEntityPrivateKey, false),
+ rsp: makeTrillianQueueLeafResponse(t, testPackage, testdata.IntermediateChain, testdata.EndEntityPrivateKey, false),
},
} {
if err := checkQueueLeaf(table.rsp, table.err); (err != nil) != table.wantErr {
@@ -58,15 +58,18 @@ func TestCheckGetLeavesByRange(t *testing.T) {
}{
{
description: "bad response: trillian error",
+ req: &GetEntriesRequest{Start: 0, End: 1},
err: fmt.Errorf("backend error"),
wantErr: true,
},
{
description: "bad response: empty",
+ req: &GetEntriesRequest{Start: 0, End: 1},
wantErr: true,
},
{
description: "bad response: no leaves",
+ req: &GetEntriesRequest{Start: 0, End: 1},
rsp: func(rsp *trillian.GetLeavesByRangeResponse) *trillian.GetLeavesByRangeResponse {
rsp.Leaves = nil
return rsp
@@ -75,6 +78,7 @@ func TestCheckGetLeavesByRange(t *testing.T) {
},
{
description: "bad response: no signed log root",
+ req: &GetEntriesRequest{Start: 0, End: 1},
rsp: func(rsp *trillian.GetLeavesByRangeResponse) *trillian.GetLeavesByRangeResponse {
rsp.SignedLogRoot = nil
return rsp
@@ -83,6 +87,7 @@ func TestCheckGetLeavesByRange(t *testing.T) {
},
{
description: "bad response: no log root",
+ req: &GetEntriesRequest{Start: 0, End: 1},
rsp: func(rsp *trillian.GetLeavesByRangeResponse) *trillian.GetLeavesByRangeResponse {
rsp.SignedLogRoot.LogRoot = nil
return rsp