This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 9c9ceba  Fix TO client urlsig path (#5705)
9c9ceba is described below

commit 9c9ceba2f219426cf62aaf936364b8e6e137d85c
Author: Robert O Butts <[email protected]>
AuthorDate: Fri Apr 2 10:22:48 2021 -0600

    Fix TO client urlsig path (#5705)
---
 .../testing/api/v2/deliveryservices_test.go        | 22 ++++++++++++++++++++++
 .../testing/api/v3/deliveryservices_test.go        | 16 ++++++++++++++++
 .../testing/api/v4/deliveryservices_test.go        | 16 ++++++++++++++++
 traffic_ops/v2-client/deliveryservice.go           |  2 +-
 traffic_ops/v3-client/deliveryservice.go           |  2 +-
 traffic_ops/v4-client/deliveryservice.go           |  2 +-
 6 files changed, 57 insertions(+), 3 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/testing/api/v4/deliveryservices_test.go 
b/traffic_ops/testing/api/v4/deliveryservices_test.go
index a0b09a0..9f17a6c 100644
--- a/traffic_ops/testing/api/v4/deliveryservices_test.go
+++ b/traffic_ops/testing/api/v4/deliveryservices_test.go
@@ -43,6 +43,7 @@ func TestDeliveryServices(t *testing.T) {
 
                if includeSystemTests {
                        SSLDeliveryServiceCDNUpdateTest(t)
+                       GetTestDeliveryServicesURLSigKeys(t)
                }
                GetTestDeliveryServicesIMS(t)
                GetAccessibleToTest(t)
@@ -1236,3 +1237,18 @@ func VerifyPaginationSupportDS(t *testing.T) {
                t.Errorf("expected GET deliveryservice to return an error for 
page is not a positive integer, actual error: " + err.Error())
        }
 }
+
+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 9a52876..395e0cf 100644
--- a/traffic_ops/v3-client/deliveryservice.go
+++ b/traffic_ops/v3-client/deliveryservice.go
@@ -154,7 +154,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"
diff --git a/traffic_ops/v4-client/deliveryservice.go 
b/traffic_ops/v4-client/deliveryservice.go
index 0bcaa0c..8023c01 100644
--- a/traffic_ops/v4-client/deliveryservice.go
+++ b/traffic_ops/v4-client/deliveryservice.go
@@ -93,7 +93,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/v3/deliveryservices_xmlid_xmlid_urlkeys.html
-       APIDeliveryServicesURLSigKeys = APIDeliveryServices + 
"/xmlid/%s/urlkeys"
+       APIDeliveryServicesURLSigKeys = APIDeliveryServices + 
"/xmlId/%s/urlkeys"
 
        // APIDeliveryServicesRegexes is the API path on which Traffic Ops 
serves Delivery Service
        // 'regex' (Regular Expression) information.

Reply via email to