mitchell852 commented on a change in pull request #5717:
URL: https://github.com/apache/trafficcontrol/pull/5717#discussion_r609210182



##########
File path: traffic_ops/testing/api/v4/deliveryservices_test.go
##########
@@ -1238,6 +1254,272 @@ func VerifyPaginationSupportDS(t *testing.T) {
        }
 }
 
+func GetDeliveryServiceByCdn(t *testing.T) {
+
+       if len(testData.DeliveryServices) > 0 {
+               firstDS := testData.DeliveryServices[0]
+
+               if firstDS.CDNID == nil && firstDS.CDNName != nil {
+                       cdns, _, err := 
TOSession.GetCDNByNameWithHdr(*firstDS.CDNName, nil)
+                       if err != nil {
+                               t.Fatalf("Error in Getting CDN by Name: %v", 
err)
+                       }
+                       if len(cdns) == 0 {
+                               t.Fatalf("no CDN named %v" + *firstDS.CDNName)
+                       }
+                       firstDS.CDNID = &cdns[0].ID
+               }
+               resp, _, err := 
TOSession.GetDeliveryServicesByCDNIDWithHdr(*firstDS.CDNID, nil)

Review comment:
       can you give him an example of how stuff should be written to avoid that?

##########
File path: traffic_ops/testing/api/v4/deliveryservices_test.go
##########
@@ -1238,6 +1254,272 @@ func VerifyPaginationSupportDS(t *testing.T) {
        }
 }
 
+func GetDeliveryServiceByCdn(t *testing.T) {
+
+       if len(testData.DeliveryServices) > 0 {
+               firstDS := testData.DeliveryServices[0]
+
+               if firstDS.CDNID == nil && firstDS.CDNName != nil {
+                       cdns, _, err := 
TOSession.GetCDNByNameWithHdr(*firstDS.CDNName, nil)
+                       if err != nil {
+                               t.Fatalf("Error in Getting CDN by Name: %v", 
err)
+                       }
+                       if len(cdns) == 0 {
+                               t.Fatalf("no CDN named %v" + *firstDS.CDNName)
+                       }
+                       firstDS.CDNID = &cdns[0].ID
+               }
+               resp, _, err := 
TOSession.GetDeliveryServicesByCDNIDWithHdr(*firstDS.CDNID, nil)

Review comment:
       can you give him an example of how stuff should be written to avoid 
segfaults?




-- 
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]


Reply via email to