From 5498b4ee782d2878a69e7311bd5bf7a21b1e6f04 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Mon, 1 Mar 2021 10:39:40 +0100 Subject: added deadline matcher Test that gRPC calls have deadlines. --- sth_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sth_test.go') 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) -- cgit v1.2.3