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 46941a8 Fix validation for an edge node parenting a mid node in a
Topology (#4815)
46941a8 is described below
commit 46941a893bcb067dd0380f24f07b8d33ff3f3814
Author: Zach Hoffman <[email protected]>
AuthorDate: Tue Jun 23 16:03:16 2020 +0000
Fix validation for an edge node parenting a mid node in a Topology (#4815)
* Fix validation for an edge node parenting a mid node in a Topology
* Let default case include mid caches
---
traffic_ops/testing/api/v3/topologies_test.go | 5 +++--
traffic_ops/traffic_ops_golang/topology/validation.go | 3 +--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/traffic_ops/testing/api/v3/topologies_test.go
b/traffic_ops/testing/api/v3/topologies_test.go
index 5942adc..dac92ad 100644
--- a/traffic_ops/testing/api/v3/topologies_test.go
+++ b/traffic_ops/testing/api/v3/topologies_test.go
@@ -104,8 +104,9 @@ func ValidationTestTopologies(t *testing.T) {
{Cachegroup: "cachegroup1", Parents: []int{0, 1, 2}},
}}},
{testCaseDescription: "an edge parenting a mid", Topology:
tc.Topology{Name: "edge-parent-of-mid", Description: "Invalid because an edge
is a parent of a mid", Nodes: []tc.TopologyNode{
- {Cachegroup: "parentCachegroup", Parents: []int{1}},
- {Cachegroup: "cachegroup1", Parents: []int{}},
+ {Cachegroup: "cachegroup1", Parents: []int{1}},
+ {Cachegroup: "parentCachegroup", Parents: []int{2}},
+ {Cachegroup: "cachegroup2", Parents: []int{}},
}}},
{testCaseDescription: "a leaf mid", Topology: tc.Topology{Name:
"leaf-mid", Description: "Invalid because a mid is a leaf node", Nodes:
[]tc.TopologyNode{
{Cachegroup: "parentCachegroup", Parents: []int{1}},
diff --git a/traffic_ops/traffic_ops_golang/topology/validation.go
b/traffic_ops/traffic_ops_golang/topology/validation.go
index d9fb2d6..aff73d3 100644
--- a/traffic_ops/traffic_ops_golang/topology/validation.go
+++ b/traffic_ops/traffic_ops_golang/topology/validation.go
@@ -79,10 +79,9 @@ func (topology *TOTopology) checkForEdgeParents(cacheGroups
[]tc.CacheGroupNulla
topology.Nodes[parentCacheGroupIndex].Cachegroup,
parentTerm,
node.Cachegroup))
- case tc.CacheGroupMidTypeName:
default:
errs = append(errs, fmt.Errorf(
- "cachegroup %s's type is %s; it cannot be a
child of %s-typed cachegroup %s",
+ "cachegroup %s's type is %s; it cannot parent a
%s-typed cachegroup %s",
topology.Nodes[parentCacheGroupIndex].Cachegroup,
parentCacheGroupType,
cacheGroupType,