You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2021/01/13 16:12:03 UTC

[trafficcontrol] 02/03: Ignore parent upd_pending for parent ORG_LOC-type Cache Groups (#5425)

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

ocket8888 pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 008d26c001a80329f506d8e6808b187393767cc2
Author: Zach Hoffman <zr...@apache.org>
AuthorDate: Wed Jan 13 08:58:25 2021 -0700

    Ignore parent upd_pending for parent ORG_LOC-type Cache Groups (#5425)
    
    (cherry picked from commit e779b4030acab6b924cc4f17cc76642dcea32e49)
---
 traffic_ops/testing/api/v3/serverupdatestatus_test.go          | 4 ++++
 traffic_ops/testing/api/v3/tc-fixtures.json                    | 3 ++-
 traffic_ops/traffic_ops_golang/server/servers_update_status.go | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/traffic_ops/testing/api/v3/serverupdatestatus_test.go b/traffic_ops/testing/api/v3/serverupdatestatus_test.go
index 0682d85..7483e7f 100644
--- a/traffic_ops/testing/api/v3/serverupdatestatus_test.go
+++ b/traffic_ops/testing/api/v3/serverupdatestatus_test.go
@@ -474,6 +474,10 @@ func TestSetTopologiesServerUpdateStatuses(t *testing.T) {
 			}
 		}
 
+		// midCacheGroup has an ORG_LOC non-topology parent cachegroup
+		if updateStatusByCacheGroup[midCacheGroup].ParentPending {
+			t.Fatalf("expected UpdPending: %t, actual: %t", false, updateStatusByCacheGroup[midCacheGroup].ParentPending)
+		}
 		// edgeCacheGroup is a descendant of midCacheGroup
 		if !updateStatusByCacheGroup[edgeCacheGroup].ParentPending {
 			t.Fatalf("expected UpdPending: %t, actual: %t", true, updateStatusByCacheGroup[edgeCacheGroup].ParentPending)
diff --git a/traffic_ops/testing/api/v3/tc-fixtures.json b/traffic_ops/testing/api/v3/tc-fixtures.json
index 5a19eed..2bbcd85 100644
--- a/traffic_ops/testing/api/v3/tc-fixtures.json
+++ b/traffic_ops/testing/api/v3/tc-fixtures.json
@@ -179,7 +179,8 @@
             "longitude": 0,
             "name": "topology-mid-cg-04",
             "shortName": "tm4",
-            "typeName": "MID_LOC"
+            "typeName": "MID_LOC",
+            "parentCachegroupName": "multiOriginCachegroup"
         },
         {
             "latitude": 0,
diff --git a/traffic_ops/traffic_ops_golang/server/servers_update_status.go b/traffic_ops/traffic_ops_golang/server/servers_update_status.go
index e0ca033..d1d2a67 100644
--- a/traffic_ops/traffic_ops_golang/server/servers_update_status.go
+++ b/traffic_ops/traffic_ops_golang/server/servers_update_status.go
@@ -88,7 +88,9 @@ SELECT s.id, s.cachegroup, s.cdn_id, s.upd_pending, s.reval_pending, s.status, t
 SELECT ps.id, ps.cachegroup, ps.cdn_id, ps.upd_pending, ps.reval_pending, ps.status
 		FROM server ps
 	LEFT JOIN status AS pstatus ON pstatus.id = ps.status
+	LEFT JOIN type t ON ps."type" = t.id
 	WHERE pstatus.name = ANY($1::TEXT[])
+	AND t."name" LIKE ANY($4::TEXT[])
 ), use_reval_pending AS (
 SELECT value::BOOLEAN
 	FROM parameter