Skip to content

Commit

Permalink
auditor: Type Switching error to discent between connection errors an…
Browse files Browse the repository at this point in the history
…d tampering
  • Loading branch information
iknite committed Mar 6, 2019
1 parent a7b9e9d commit ea92130
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions gossip/auditor/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,16 @@ type MembershipTask struct {
func (t MembershipTask) Do() {
proof, err := t.qed.MembershipDigest(t.s.Snapshot.EventDigest, t.s.Snapshot.Version)
if err != nil {
// retry
metrics.QedAuditorGetMembershipProofErrTotal.Inc()
// TODO: retry
log.Infof("Unable to get membership proof from QED server: %s", err.Error())

switch fmt.Sprintf("%T", err) {
case "*errors.errorString":
t.sendAlert(fmt.Sprintf("Unable to get membership proof from QED server: %s", err.Error()))
default:
metrics.QedAuditorGetMembershipProofErrTotal.Inc()
}

return
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestAgents(t *testing.T) {
time.Sleep(1 * time.Second)
alerts, err := getAlert()
assert.NoError(t, err)
assert.True(t, strings.Contains(string(alerts), "Unable to verify snapshot"), "Must exist auditor alerts")
assert.True(t, strings.Contains(string(alerts), "Unable to get membership proof"), "Must exist auditor alerts")
})

let("Check Monitor does not create any alert", func(t *testing.T) {
Expand Down

0 comments on commit ea92130

Please sign in to comment.