Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit a7bcc64

Browse files
committed
update test
1 parent 6792d67 commit a7bcc64

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

impl/monitor/monitor.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ var (
5656
// ErrInvalidSignature occurs when the signature on the observed map root is
5757
// invalid.
5858
ErrInvalidSignature = errors.New("Recreated root does not match")
59+
// ErrNothingProcessed occurs when the monitor did not process any mutations /
60+
// smrs yet.
61+
ErrNothingProcessed = errors.New("did not process any mutations yet")
5962
)
6063

6164
// Server holds internal state for the monitor server.
@@ -105,7 +108,7 @@ func (s *Server) GetSignedMapRoot(ctx context.Context, in *ktpb.GetMonitoringReq
105108
if len(s.proccessedSMRs) > 0 {
106109
return s.proccessedSMRs[len(s.proccessedSMRs)-1], nil
107110
}
108-
return nil, errors.New("did not process any mutations yet")
111+
return nil, ErrNothingProcessed
109112
}
110113

111114
// GetSignedMapRootStream is a streaming API similar to GetSignedMapRoot.

impl/monitor/monitor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
func TestGetSignedMapRoot(t *testing.T) {
2929
srv := Server{}
3030
_, err := srv.GetSignedMapRoot(context.TODO(), nil)
31-
if got, want := grpc.Code(err), codes.OK; got != want {
31+
if got, want := err, ErrNothingProcessed; got != want {
3232
t.Errorf("GetSignedMapRoot(_, _): %v, want %v", got, want)
3333
}
3434
}

0 commit comments

Comments
 (0)