Fix TO client urlsig path (#5705)
(cherry picked from commit 9c9ceba2f219426cf62aaf936364b8e6e137d85c)
diff --git a/traffic_ops/testing/api/v2/deliveryservices_test.go b/traffic_ops/testing/api/v2/deliveryservices_test.go
index a8ee227..a37ca2c 100644
--- a/traffic_ops/testing/api/v2/deliveryservices_test.go
+++ b/traffic_ops/testing/api/v2/deliveryservices_test.go
@@ -21,6 +21,7 @@
"fmt"
"reflect"
"strconv"
+ "strings"
"testing"
"time"
@@ -32,6 +33,9 @@
func TestDeliveryServices(t *testing.T) {
WithObjs(t, []TCObj{CDNs, Types, Tenants, Users, Parameters, Profiles, Statuses, Divisions, Regions, PhysLocations, CacheGroups, Servers, DeliveryServices}, func() {
GetAccessibleToTest(t)
+ if includeSystemTests {
+ GetTestDeliveryServicesURLSigKeys(t)
+ }
UpdateTestDeliveryServices(t)
UpdateNullableTestDeliveryServices(t)
UpdateDeliveryServiceWithInvalidRemapText(t)
@@ -549,3 +553,21 @@
}
}
+
+func GetTestDeliveryServicesURLSigKeys(t *testing.T) {
+ if len(testData.DeliveryServices) == 0 {
+ t.Fatal("couldn't get the xml ID of test DS")
+ }
+ firstDS := testData.DeliveryServices[0]
+ if firstDS.XMLID == nil {
+ t.Fatal("couldn't get the xml ID of test DS")
+ }
+
+ _, _, err := TOSession.GetDeliveryServiceURLSigKeys(*firstDS.XMLID)
+ if err != nil {
+ // The v2 tests don't support Riak, so the only thing we can test is that the endpoint exists.
+ if errStr := strings.ToLower(err.Error()); strings.Contains(errStr, "not found") || strings.Contains(errStr, "404") {
+ t.Error("Expected URL Sig path to exist, actual: " + err.Error())
+ }
+ }
+}
diff --git a/traffic_ops/testing/api/v3/deliveryservices_test.go b/traffic_ops/testing/api/v3/deliveryservices_test.go
index aa565ad..1068ff0 100644
--- a/traffic_ops/testing/api/v3/deliveryservices_test.go
+++ b/traffic_ops/testing/api/v3/deliveryservices_test.go
@@ -43,6 +43,7 @@
if includeSystemTests {
SSLDeliveryServiceCDNUpdateTest(t)
+ GetTestDeliveryServicesURLSigKeys(t)
}
GetTestDeliveryServicesIMS(t)
GetAccessibleToTest(t)
@@ -1171,3 +1172,18 @@
t.Error("expected tenant4user to be unable to create a deliveryservice outside of its tenant")
}
}
+
+func GetTestDeliveryServicesURLSigKeys(t *testing.T) {
+ if len(testData.DeliveryServices) == 0 {
+ t.Fatal("couldn't get the xml ID of test DS")
+ }
+ firstDS := testData.DeliveryServices[0]
+ if firstDS.XMLID == nil {
+ t.Fatal("couldn't get the xml ID of test DS")
+ }
+
+ _, _, err := TOSession.GetDeliveryServiceURLSigKeysWithHdr(*firstDS.XMLID, nil)
+ if err != nil {
+ t.Error("failed to get url sig keys: " + err.Error())
+ }
+}
diff --git a/traffic_ops/v2-client/deliveryservice.go b/traffic_ops/v2-client/deliveryservice.go
index e56aaed..adca1f0 100644
--- a/traffic_ops/v2-client/deliveryservice.go
+++ b/traffic_ops/v2-client/deliveryservice.go
@@ -85,7 +85,7 @@
// by its XMLID. It is intended to be used with fmt.Sprintf to insert its required path parameter
// (namely the XMLID of the Delivery Service of interest).
// See Also: https://traffic-control-cdn.readthedocs.io/en/latest/api/v2/deliveryservices_xmlid_xmlid_urlkeys.html
- API_DELIVERY_SERVICES_URL_SIGNING_KEYS = API_DELIVERY_SERVICES + "/xmlid/%s/urlkeys"
+ API_DELIVERY_SERVICES_URL_SIGNING_KEYS = API_DELIVERY_SERVICES + "/xmlId/%s/urlkeys"
// API_DELIVERY_SERVICES_REGEXES is the API path on which Traffic Ops serves Delivery Service
// 'regex' (Regular Expression) information.
diff --git a/traffic_ops/v3-client/deliveryservice.go b/traffic_ops/v3-client/deliveryservice.go
index 589863f..cccfe75 100644
--- a/traffic_ops/v3-client/deliveryservice.go
+++ b/traffic_ops/v3-client/deliveryservice.go
@@ -153,7 +153,7 @@
APIDeliveryServiceXmlidSslKeys = APIDeliveryServices + "/xmlId/%s/sslkeys"
APIDeliveryServiceGenerateSslKeys = APIDeliveryServices + "/sslkeys/generate"
APIDeliveryServicesUriSigningKeys = APIDeliveryServices + "/%s/urisignkeys"
- APIDeliveryServicesUrlSigningKeys = APIDeliveryServices + "/xmlid/%s/urlkeys"
+ APIDeliveryServicesUrlSigningKeys = APIDeliveryServices + "/xmlId/%s/urlkeys"
APIDeliveryServicesRegexes = "/deliveryservices_regexes"
APIServerDeliveryServices = "/servers/%d/deliveryservices"
APIDeliveryServiceServer = "/deliveryserviceserver"