diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-23 21:36:00 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-23 21:36:00 +0100 |
commit | b2e10535ef094e8bc9995769c2a22a1ee29cbe57 (patch) | |
tree | adce4aaef9978a04e09d24499f99752c6d2dbf8c /server/testdata/helper.go | |
parent | 15444f91e74de6e1ca8ea99511e8cb6dcd92fa91 (diff) |
added start on isolated trillian checks
Diffstat (limited to 'server/testdata/helper.go')
-rw-r--r-- | server/testdata/helper.go | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/server/testdata/helper.go b/server/testdata/helper.go deleted file mode 100644 index 6874616..0000000 --- a/server/testdata/helper.go +++ /dev/null @@ -1,47 +0,0 @@ -package testdata - -import ( - "testing" - - "github.com/google/trillian" - "github.com/google/trillian/types" -) - -// NewGetLatestSignedLogRootResponse creates a new trillian STH. Revision, -// Metadata, Proof, KeyHint, and LogRootSignature are unsset. -func NewGetLatestSignedLogRootResponse(t *testing.T, timestamp, size uint64, hash []byte) *trillian.GetLatestSignedLogRootResponse { - t.Helper() - return &trillian.GetLatestSignedLogRootResponse{ - SignedLogRoot: marshalSignedLogRoot(t, &types.LogRootV1{ - TreeSize: size, - RootHash: hash, - TimestampNanos: timestamp, - Revision: 0, // not used by stfe - Metadata: nil, // not used by stfe - }), - Proof: nil, // not used by stfe - } -} - -// TruncatedSignedLogRootResponse creates a truncated signed log root response -// that cannot be unmarshalled, i.e., SignedLogRoot.LogRoot is invalid. -func TruncatedSignedLogRootResponse(t *testing.T) *trillian.GetLatestSignedLogRootResponse { - t.Helper() - slrr := NewGetLatestSignedLogRootResponse(t, 0, 0, make([]byte, 32)) - slrr.SignedLogRoot.LogRoot = slrr.SignedLogRoot.LogRoot[1:] - return slrr -} - -// marshalSignedLogRoot must marshal a signed log root -func marshalSignedLogRoot(t *testing.T, lr *types.LogRootV1) *trillian.SignedLogRoot { - t.Helper() - rootBytes, err := lr.MarshalBinary() - if err != nil { - t.Fatalf("failed to marshal root in test: %v", err) - } - return &trillian.SignedLogRoot{ - KeyHint: nil, // not used by stfe - LogRoot: rootBytes, - LogRootSignature: nil, // not used by stfe - } -} |