Currently to verify errors in our tests, we use string comparison which is very brittle. Looking to implement an alternative solution to provide similar functionality. Here's an example of where we use string comparisons in mock_metric_test.go:
if !strings.Contains(err.Error(), want.Error()) {
t.Errorf("CreateMetricDescriptor(%q) returned error %q, expected error %q",
in, err.Error(), want)
}
We should switch to just comparing the codes, instead of the error strings themselves
Currently to verify errors in our tests, we use string comparison which is very brittle. Looking to implement an alternative solution to provide similar functionality. Here's an example of where we use string comparisons in
mock_metric_test.go
:We should switch to just comparing the codes, instead of the error strings themselves