zrhoffman commented on a change in pull request #5128:
URL: https://github.com/apache/trafficcontrol/pull/5128#discussion_r505731519
##########
File path: traffic_ops/traffic_ops_golang/server/servers_test.go
##########
@@ -475,7 +475,7 @@ func TestGetMidServers(t *testing.T) {
mock.ExpectBegin()
mock.ExpectQuery("SELECT").WillReturnRows(rows2)
- mid, userErr, sysErr, errCode := getMidServers(serverIDs, serverMap,
db.MustBegin())
+ mid, userErr, sysErr, errCode := getMidServers(serverIDs, serverMap, 0,
db.MustBegin())
Review comment:
This should return an actual CDN ID
##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -1009,7 +1013,12 @@ func getMidServers(edgeIDs []int, servers
map[int]tc.ServerNullable, tx *sqlx.Tx
WHERE s.id IN (?)))
`
- query, args, err := sqlx.In(q, edgeIDs)
+ if cdnID > 0 {
+ q += ` AND s.cdn_id = ?`
+ filters = append(filters, cdnID)
+ }
Review comment:
Checking if `cdnID` is greater than 0 should be unnecessary because
servers are always in CDNs
----------------------------------------------------------------
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]