ocket8888 commented on a change in pull request #5071:
URL: https://github.com/apache/trafficcontrol/pull/5071#discussion_r501142310
##########
File path: traffic_ops/testing/api/v3/deliveryservice_requests_test.go
##########
@@ -209,29 +405,43 @@ func TestDeliveryServiceRequestWorkflow(t *testing.T) {
}
alerts, dsr := updateDeliveryServiceRequestStatus(t, dsrs[0],
"submitted")
+ found = false
+ for _, alert := range alerts.Alerts {
+ if alert.Level == tc.ErrorLevel.String() {
+ t.Errorf("Unexpected error-level alert: %s",
alert.Text)
+ } else if alert.Level == tc.SuccessLevel.String() &&
strings.Contains(alert.Text, "updated") {
+ found = true
+ }
+ }
- expected = []string{
- "deliveryservice_request was updated.",
+ if !found {
+ t.Error("Didn't find success-level alert after
updating")
}
- utils.Compare(t, expected, alerts.ToStrings())
if dsr.Status != tc.RequestStatus("submitted") {
t.Errorf("expected status=submitted, got %s",
string(dsr.Status))
}
})
}
-func updateDeliveryServiceRequestStatus(t *testing.T, dsr
tc.DeliveryServiceRequest, newstate string) (tc.Alerts,
tc.DeliveryServiceRequest) {
- ID := dsr.ID
+func updateDeliveryServiceRequestStatus(t *testing.T, dsr
tc.DeliveryServiceRequestV30, newstate string) (tc.Alerts,
tc.DeliveryServiceRequestV30) {
+ if dsr.ID == nil {
+ t.Error("Cannot update DSR with no ID")
Review comment:
That's not an error string, it's a testing error, which is printed
directly, not returned to the caller to be possibly appended to something else.
From that same section:
> This does not apply to logging, which is implicitly line-oriented and not
combined inside other messages.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]