This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/5.1.x by this push:
new 2f0bdad Fix TO client urlsig path (#5705)
2f0bdad is described below
commit 2f0bdadbd54e07a4dc5715d64846e353bdd527e5
Author: Robert O Butts <[email protected]>
AuthorDate: Fri Apr 2 10:22:48 2021 -0600
Fix TO client urlsig path (#5705)
(cherry picked from commit 9c9ceba2f219426cf62aaf936364b8e6e137d85c)
---
.../testing/api/v2/deliveryservices_test.go | 22 ++++++++++++++++++++++
.../testing/api/v3/deliveryservices_test.go | 16 ++++++++++++++++
traffic_ops/v2-client/deliveryservice.go | 2 +-
traffic_ops/v3-client/deliveryservice.go | 2 +-
4 files changed, 40 insertions(+), 2 deletions(-)
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 @@ import (
"fmt"
"reflect"
"strconv"
+ "strings"
"testing"
"time"
@@ -32,6 +33,9 @@ import (
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 DeliveryServiceTenancyTest(t *testing.T) {
}
}
+
+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 @@ func TestDeliveryServices(t *testing.T) {
if includeSystemTests {
SSLDeliveryServiceCDNUpdateTest(t)
+ GetTestDeliveryServicesURLSigKeys(t)
}
GetTestDeliveryServicesIMS(t)
GetAccessibleToTest(t)
@@ -1171,3 +1172,18 @@ func DeliveryServiceTenancyTest(t *testing.T) {
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 @@ const (
// 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 @@ const (
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"