diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-03-01 10:39:40 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-03-01 10:39:40 +0100 |
commit | 5498b4ee782d2878a69e7311bd5bf7a21b1e6f04 (patch) | |
tree | 1b519ba86e2c8b009e8643bae22a595d68885216 /sth_test.go | |
parent | c05c22ddbc771e7713849cae40f9d91bfafa0503 (diff) |
added deadline matcher
Test that gRPC calls have deadlines.
Diffstat (limited to 'sth_test.go')
-rw-r--r-- | sth_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sth_test.go b/sth_test.go index e5914c6..a75ca5f 100644 --- a/sth_test.go +++ b/sth_test.go @@ -41,7 +41,7 @@ func TestNewActiveSthSource(t *testing.T) { func() { // run deferred functions at the end of each iteration ti := newTestInstance(t, table.signer) defer ti.ctrl.Finish() - ti.client.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(table.trsp, table.terr) + ti.client.EXPECT().GetLatestSignedLogRoot(newDeadlineMatcher(), gomock.Any()).Return(table.trsp, table.terr) source, err := NewActiveSthSource(ti.client, ti.instance.LogParameters) if got, want := err != nil, table.wantErr; got != want { t.Errorf("got error %v but wanted %v in test %q: %v", got, want, table.description, err) @@ -102,7 +102,7 @@ func TestLatest(t *testing.T) { func() { // run deferred functions at the end of each iteration ti := newTestInstance(t, table.signer) defer ti.ctrl.Finish() - ti.client.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(table.trsp, table.terr) + ti.client.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(table.trsp, table.terr) // no deadline matcher because context is set by the caller of Latest(), i.e., this test on the line below sth, err := ti.instance.SthSource.Latest(context.Background()) if got, want := err != nil, table.wantErr; got != want { t.Errorf("got error %v but wanted %v in test %q: %v", got, want, table.description, err) |