srijeet0406 commented on code in PR #7023:
URL: https://github.com/apache/trafficcontrol/pull/7023#discussion_r952020931


##########
traffic_ops/testing/api/v4/servers_test.go:
##########
@@ -423,6 +400,31 @@ func TestServers(t *testing.T) {
        })
 }
 
+func setupCacheGroupWithASN(t *testing.T) {
+       // Add a new asn for one of the cachegroups
+       cgResp, _, err := 
TOSession.GetCacheGroups(client.RequestOptions{QueryParameters: 
url.Values{"name": {"topology-mid-cg-01"}}})
+       if err != nil {
+               t.Fatalf("couldn't get cachegroups: %v", err)
+       }
+       if len(cgResp.Response) != 1 {
+               t.Fatalf("expected 1 cachegroup, but got %d", 
len(cgResp.Response))
+       }
+       if cgResp.Response[0].ID == nil {
+               t.Fatalf("ID of cachegroup is nil")
+       }
+
+       asn := tc.ASN{
+               ASN:          1111,
+               Cachegroup:   "topology-mid-cg-01",
+               CachegroupID: *cgResp.Response[0].ID,
+       }
+
+       _, _, err = TOSession.CreateASN(asn, client.NewRequestOptions())
+       if err != nil {
+               t.Fatalf("couldn't create ASN: %v", err)
+       }
+}
+

Review Comment:
   So I think there is a bug in the way our tests are reading the ASNs. If you 
add that section into the fixtures file, and do a `TOSession.GetASNS()`, the 
results that come back are:
   `{1111 originCachegroup 18999 145 2022-08-22 17:48:28-06}
   {8888 originCachegroup 18999 143 2022-08-22 17:48:28-06}
   {9999 originCachegroup 18999 144 2022-08-22 17:48:28-06}`
   
   This is incorrect. I'll create a separate issue for that.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to