You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/03/05 23:13:22 UTC

[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5605: Added the ability to change a server capability name

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



##########
File path: traffic_ops/testing/api/v4/servercapabilities_test.go
##########
@@ -89,6 +90,41 @@ func ValidationTestServerCapabilities(t *testing.T) {
 	}
 }
 
+func UpdateTestServerCapabilities(t *testing.T) {
+	var header http.Header
+
+	// Get server capability name and edit it to a new name
+	resp, _, err := TOSession.GetServerCapabilitiesWithHdr(header)
+	if err != nil {
+		t.Fatalf("Expected no error, but got %v", err.Error())
+	}
+	origName := resp[0].Name
+	newSCName := "sc-test"
+	resp[0].Name = newSCName
+
+	// Update server capability with new name
+	updateResponse, _, err := TOSession.UpdateServerCapabilityByName(origName, &resp[0])
+	if err != nil {
+		t.Errorf("cannot PUT server capability: %v - %v", err, updateResponse)
+	}
+
+	// Get updated name
+	getResp, _, err := TOSession.GetServerCapabilityWithHdr(newSCName, header)
+	if err != nil {

Review comment:
       In GetServerCapabilityWithHdr(), the check is already present and hence I didn't add the check.




----------------------------------------------------------------
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:
users@infra.apache.org