You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2021/03/15 17:41:00 UTC
[trafficcontrol] branch master updated: Fix atscfg comparing
pointers not values (#5536)
This is an automated email from the ASF dual-hosted git repository.
zrhoffman 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 7c8fae6 Fix atscfg comparing pointers not values (#5536)
7c8fae6 is described below
commit 7c8fae62ed6869136946db362e80c0251d5beb5b
Author: Robert O Butts <ro...@users.noreply.github.com>
AuthorDate: Mon Mar 15 11:40:45 2021 -0600
Fix atscfg comparing pointers not values (#5536)
---
CHANGELOG.md | 1 +
lib/go-atscfg/headerrewritemiddotconfig.go | 2 +-
lib/go-atscfg/headerrewritemiddotconfig_test.go | 20 ++++++++++++++------
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 720286c..b7cb567 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -72,6 +72,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#5395](https://github.com/apache/trafficcontrol/issues/5395) - Added validation to prevent changing the Type any Cache Group that is in use by a Topology
- [#5384](https://github.com/apache/trafficcontrol/issues/5384) - New grids will now properly remember the current page number.
- Fix for public schema in 2020062923101648_add_deleted_tables.sql
+- Fix for config gen missing max_origin_connections on mids in certain scenarios
- Fixed and issue with 2020082700000000_server_id_primary_key.sql trying to create multiple primary keys when there are multiple schemas.
- Moved move_lets_encrypt_to_acme.sql, add_max_request_header_size_delivery_service.sql, and server_interface_ip_address_cascade.sql past last migration in 5.0.0
- [#5505](https://github.com/apache/trafficcontrol/issues/5505) - Make `parent_reval_pending` for servers in a Flexible Topology CDN-specific on `GET /servers/{name}/update_status`
diff --git a/lib/go-atscfg/headerrewritemiddotconfig.go b/lib/go-atscfg/headerrewritemiddotconfig.go
index f4e7947..d0a6bf4 100644
--- a/lib/go-atscfg/headerrewritemiddotconfig.go
+++ b/lib/go-atscfg/headerrewritemiddotconfig.go
@@ -94,7 +94,7 @@ func MakeHeaderRewriteMidDotConfig(
continue
}
- if sv.CDNName != server.CDNName {
+ if *sv.CDNName != *server.CDNName {
continue
}
if _, ok := assignedServers[*sv.ID]; !ok && (tcDS.Topology == nil || *tcDS.Topology == "") {
diff --git a/lib/go-atscfg/headerrewritemiddotconfig_test.go b/lib/go-atscfg/headerrewritemiddotconfig_test.go
index b6203a5..92cf693 100644
--- a/lib/go-atscfg/headerrewritemiddotconfig_test.go
+++ b/lib/go-atscfg/headerrewritemiddotconfig_test.go
@@ -32,39 +32,47 @@ func TestMakeHeaderRewriteMidDotConfig(t *testing.T) {
hdr := "myHeaderComment"
server := makeGenericServer()
- server.CDNName = &cdnName
+ server.CDNName = util.StrPtr(cdnName)
server.Cachegroup = util.StrPtr("edgeCG")
server.HostName = util.StrPtr("myserver")
serverStatus := string(tc.CacheStatusReported)
server.Status = &serverStatus
+ // server, as inserted in servers.
+ // needs to be different, so the pointers are different, like they will be with different API calls.
+ serverSvs := makeGenericServer()
+ serverSvs.CDNName = util.StrPtr(cdnName)
+ serverSvs.Cachegroup = util.StrPtr("edgeCG")
+ serverSvs.HostName = util.StrPtr("myserver")
+ serverSvs.Status = util.StrPtr(string(tc.CacheStatusReported))
+
ds := makeGenericDS()
ds.EdgeHeaderRewrite = util.StrPtr("edgerewrite")
ds.ID = util.IntPtr(24)
ds.XMLID = util.StrPtr("ds0")
ds.MaxOriginConnections = util.IntPtr(42)
ds.MidHeaderRewrite = util.StrPtr("midrewrite")
- ds.CDNName = &cdnName
+ ds.CDNName = util.StrPtr(cdnName)
dsType := tc.DSTypeHTTP
ds.Type = &dsType
ds.ServiceCategory = util.StrPtr("servicecategory")
mid0 := makeGenericServer()
- mid0.CDNName = &cdnName
+ mid0.CDNName = util.StrPtr(cdnName)
mid0.Cachegroup = util.StrPtr("midCG")
mid0.HostName = util.StrPtr("mymid0")
mid0Status := string(tc.CacheStatusReported)
mid0.Status = &mid0Status
mid1 := makeGenericServer()
- mid1.CDNName = &cdnName
+ mid1.CDNName = util.StrPtr(cdnName)
mid1.Cachegroup = util.StrPtr("midCG")
mid1.HostName = util.StrPtr("mymid1")
mid1Status := string(tc.CacheStatusOnline)
mid1.Status = &mid1Status
mid2 := makeGenericServer()
- mid2.CDNName = &cdnName
+ mid2.CDNName = util.StrPtr(cdnName)
mid2.Cachegroup = util.StrPtr("midCG")
mid2.HostName = util.StrPtr("mymid2")
mid2Status := string(tc.CacheStatusOffline)
@@ -85,7 +93,7 @@ func TestMakeHeaderRewriteMidDotConfig(t *testing.T) {
mCG.Type = &mCGType
cgs := []tc.CacheGroupNullable{*eCG, *mCG}
- servers := []Server{*server, *mid0, *mid1, *mid2}
+ servers := []Server{*serverSvs, *mid0, *mid1, *mid2}
dses := []DeliveryService{*ds}
dss := makeDSS(servers, dses)