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 4b43550 Fix TOclient topologies path (#5521) (#5585)
4b43550 is described below
commit 4b43550927ae1d69934cc26c0d38f891ae7427e4
Author: ocket8888 <[email protected]>
AuthorDate: Fri Feb 26 14:33:07 2021 -0500
Fix TOclient topologies path (#5521) (#5585)
* Fix TOclient topologies path
* Add TO test topologies to v4
(cherry picked from commit 3526335f2c1142a13bc12783aefa8faa2aac1aaa)
Co-authored-by: Robert O Butts <[email protected]>
---
traffic_ops/testing/api/v3/topologies_test.go | 14 ++++++++++++++
traffic_ops/v3-client/topology.go | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/traffic_ops/testing/api/v3/topologies_test.go
b/traffic_ops/testing/api/v3/topologies_test.go
index 7611e94..d0da4c5 100644
--- a/traffic_ops/testing/api/v3/topologies_test.go
+++ b/traffic_ops/testing/api/v3/topologies_test.go
@@ -37,6 +37,7 @@ type topologyTestCase struct {
func TestTopologies(t *testing.T) {
WithObjs(t, []TCObj{Types, CacheGroups, CDNs, Parameters, Profiles,
Statuses, Divisions, Regions, PhysLocations, Servers, ServerCapabilities,
ServerServerCapabilitiesForTopologies, Topologies, Tenants, DeliveryServices,
TopologyBasedDeliveryServiceRequiredCapabilities}, func() {
+ GetTestTopologies(t)
UpdateTestTopologies(t)
ValidationTestTopologies(t)
UpdateValidateTopologyORGServerCacheGroup(t)
@@ -61,6 +62,19 @@ func CreateTestTopologies(t *testing.T) {
}
}
+func GetTestTopologies(t *testing.T) {
+ if len(testData.Topologies) < 1 {
+ t.Fatalf("test data has no topologies, can't test")
+ }
+ topos, _, err := TOSession.GetTopologiesWithHdr(nil)
+ if err != nil {
+ t.Fatalf("expected GET error to be nil, actual: %v", err)
+ }
+ if len(topos) != len(testData.Topologies) {
+ t.Errorf("expected topologies GET to return %v topologies,
actual %v", len(testData.Topologies), len(topos))
+ }
+}
+
func EdgeParentOfEdgeSucceedsWithWarning(t *testing.T) {
testCase := topologyTestCase{testCaseDescription: "an edge parenting a
mid", Topology: tc.Topology{
Name: "edge-parent-of-edge",
diff --git a/traffic_ops/v3-client/topology.go
b/traffic_ops/v3-client/topology.go
index 0842459..54d0264 100644
--- a/traffic_ops/v3-client/topology.go
+++ b/traffic_ops/v3-client/topology.go
@@ -37,7 +37,7 @@ func (to *Session) CreateTopology(top tc.Topology)
(*tc.TopologyResponse, ReqInf
func (to *Session) GetTopologiesWithHdr(header http.Header) ([]tc.Topology,
ReqInf, error) {
var data tc.TopologiesResponse
- reqInf, err := to.get(ApiTopologies, header, &data)
+ reqInf, err := to.get(APITopologies, header, &data)
return data.Response, reqInf, err
}