rimashah25 commented on a change in pull request #5350:
URL: https://github.com/apache/trafficcontrol/pull/5350#discussion_r543794192



##########
File path: traffic_ops/testing/api/v3/topologies_test.go
##########
@@ -240,6 +241,39 @@ func UpdateTestTopologies(t *testing.T) {
        }
 }
 
+func UpdateValidateTopologyORGServerCacheGroup(t *testing.T) {
+       params := url.Values{}
+       params.Set("xmlId", "ds-top")
+
+       //Get the correct DS
+       remoteDS, _, err := TOSession.GetDeliveryServicesV30WithHdr(nil, params)
+       if err != nil {
+               t.Errorf("cannot GET Delivery Services: %v", err)
+       }
+
+       //Assign ORG server to DS
+       assignServer := []string{"denver-mso-org-01"}
+       _, _, err = TOSession.AssignServersToDeliveryService(assignServer, 
*remoteDS[0].XMLID)
+       if err != nil {
+               t.Errorf("cannot assign server to Delivery Services: %v", err)
+       }
+
+       //Get Topology node to update and remove ORG server nodes
+       resp, _, err := TOSession.GetTopologyWithHdr(*remoteDS[0].Topology, nil)
+       if err != nil {
+               t.Fatalf("couldn't find any topologies: %v", err)
+       }
+       var p []int
+       newNodes := []tc.TopologyNode{{Id: 0, Cachegroup: 
"topology-edge-cg-01", Parents: p, LastUpdated: nil}}
+       if *remoteDS[0].Topology == resp.Name {
+               resp.Nodes = newNodes
+       }
+       _, _, err = TOSession.UpdateTopology(*remoteDS[0].Topology, *resp)
+       if err == nil {
+               t.Fatalf("shouldnot UPDATE topology:%v, but update was a 
success", *remoteDS[0].Topology)
+       }

Review comment:
       Found a tiny bug:
   `Rima Shah: It seems the DS is ok with no servers assigned to it.. but the 
minute you assign one, you can’t take it away because of this condition in 
delete function: checkLastServer()
   Rawlin Peters: ah, sounds like that checkLastServer function should ignore 
ORG servers.`
   Fix for the bug in this PR.




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