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 806b0d025a add automatic self-healing when using slice plugin to t3c
(#7719)
806b0d025a is described below
commit 806b0d025ab31c5390f923701e083142c34e57f4
Author: Joe Pappano <[email protected]>
AuthorDate: Wed Sep 27 17:48:11 2023 -0400
add automatic self-healing when using slice plugin to t3c (#7719)
* add self healing for slice plugin by default
* adding auto self healing with slice plugin on mids
* add self-healing to the slice plugin automatically
* add tests for automatic self-healing when using the slice plugin
* Added documentation note for self-healing
* changed the way self-healing will be added to remap line
* removed tests that are not needed
* put back tests that were removed by mistake
* put blank line back
* added comments and change log entry
* fixed broken test, with 2 exact same delivery services
* fixed issue where empty param could add empty pparam to remap line
* added tests for issue where empty param could add empty pparam to remap
line
* commit for rebase
* fixed a couple typos
* Added tests for no self healing param
* Added ability to remove auto self-healing for slice plugin
* updated deliveryservice documentation
* removed git merge lines
* updated to use positive bools rather than negative
* changed scope of selfHeal param
* changed to error instead of fatal
---
CHANGELOG.md | 1 +
docs/source/overview/delivery_services.rst | 2 +
lib/go-atscfg/remapdotconfig.go | 31 ++-
lib/go-atscfg/remapdotconfig_test.go | 334 ++++++++++++++++++++++++++++-
4 files changed, 356 insertions(+), 12 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8397a7b1eb..38b8a05112 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -53,6 +53,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7652](https://github.com/apache/trafficcontrol/pull/7652) *Traffic Control
Cache Config (t3c)*: added rpmdb checks and use package data from
t3c-apply-metadata.json if rpmdb is corrupt.
- [#7674](https://github.com/apache/trafficcontrol/issues/7674) *Traffic Ops*:
Add the ability to indicate if a server failed its revalidate/config update.
- [#7784](https://github.com/apache/trafficcontrol/pull/7784) *Traffic
Portal*: Added revert certificate functionality to the ssl-keys page.
+- [#7719](https://github.com/apache/trafficcontrol/pull/7719) *t3c*
self-healing will be added automatically when using the slice plugin.
### Changed
- [#7776](https://github.com/apache/trafficcontrol/pull/7776)
*tc-health-client*: Added error message while issues interacting with Traffic
Ops.
diff --git a/docs/source/overview/delivery_services.rst
b/docs/source/overview/delivery_services.rst
index cda8b4d5ea..0c949812a0 100644
--- a/docs/source/overview/delivery_services.rst
+++ b/docs/source/overview/delivery_services.rst
@@ -676,6 +676,8 @@ Describes how HTTP "Range Requests" should be handled by
the Delivery Service at
3
Use the `slice
<https://github.com/apache/trafficserver/tree/master/plugins/experimental/slice>`_
plugin to slice range based requests into deterministic chunks. (Aliased as "3
- Use slice plugin" in Traffic Portal forms)
+ .. note:: The ``-–consider-ims`` parameter will automatically be added
to the remap line by :term:`t3c` for self healing. If any other range request
parameters are being used you must also include ``--consider-ims`` to enable
self healing. Automatic self healing can be disabled by adding a remap.config
parameter with a value of ``no_self_healing``
+
.. versionadded:: ATCv4.1
.. note:: Range Request Handling can only be implemented on :term:`cache
servers` using :abbr:`ATS (Apache Traffic Server)` because of its dependence on
:abbr:`ATS (Apache Traffic Server)` plugins. The value may be set on any
Delivery Service, but will have no effect when the :term:`cache servers` that
ultimately end up serving the content are e.g. Grove, Nginx, etc.
diff --git a/lib/go-atscfg/remapdotconfig.go b/lib/go-atscfg/remapdotconfig.go
index 5f9b0e277e..945417a834 100644
--- a/lib/go-atscfg/remapdotconfig.go
+++ b/lib/go-atscfg/remapdotconfig.go
@@ -71,6 +71,7 @@ const RemapConfigTemplateLast = `template.last`
const DefaultFirstRemapConfigTemplateString = `map {{{Source}}}
{{{Destination}}} {{{Strategy}}} {{{Dscp}}} {{{HeaderRewrite}}}
{{{DropQstring}}} {{{Signing}}} {{{RegexRemap}}} {{{Cachekey}}}
{{{RangeRequests}}} {{{Pacing}}} {{{RawText}}}`
const DefaultLastRemapConfigTemplateString = `map {{{Source}}}
{{{Destination}}} {{{Strategy}}} {{{HeaderRewrite}}} {{{Cachekey}}}
{{{RangeRequests}}} {{{RawText}}}`
const DefaultInnerRemapConfigTemplateString =
DefaultLastRemapConfigTemplateString
+const selfHealParam = `no_self_healing`
type LineTemplates map[string]*mustache.Template
@@ -223,16 +224,21 @@ func MakeRemapDotConfig(
// This sticks the DS parameters in a map.
// remap.config parameters use "<plugin>.pparam" key
// cachekey.config parameters retain the 'cachekey.config' key.
-func classifyConfigParams(configParams []tc.ParameterV5)
map[string][]tc.ParameterV5 {
+func classifyConfigParams(configParams []tc.ParameterV5)
(map[string][]tc.ParameterV5, bool) {
configParamMap := map[string][]tc.ParameterV5{}
+ selfHeal := true
for _, param := range configParams {
key := param.ConfigFile
if "remap.config" == key {
key = param.Name
+ if param.Value == selfHealParam {
+ selfHeal = false
+ continue
+ }
}
configParamMap[key] = append(configParamMap[key], param)
}
- return configParamMap
+ return configParamMap, selfHeal
}
// For general <plugin>.pparam parameters.
@@ -240,6 +246,9 @@ func paramsStringFor(parameters []tc.ParameterV5, warnings
*[]string) (paramsStr
uniquemap := map[string]int{}
for _, param := range parameters {
+ if strings.TrimSpace(param.Value) == "" {
+ continue
+ }
paramsString += " @pparam=" + param.Value
// Try to extract argument
@@ -407,9 +416,10 @@ func getServerConfigRemapDotConfigForMid(
cachekeyArgs = getQStringIgnoreRemap(atsMajorVersion)
}
+ selfHeal := true
dsConfigParamsMap := map[string][]tc.ParameterV5{}
if nil != ds.ProfileID {
- dsConfigParamsMap =
classifyConfigParams(profilesConfigParams[*ds.ProfileID])
+ dsConfigParamsMap, selfHeal =
classifyConfigParams(profilesConfigParams[*ds.ProfileID])
}
if len(dsConfigParamsMap) > 0 {
@@ -421,8 +431,11 @@ func getServerConfigRemapDotConfigForMid(
}
if ds.RangeRequestHandling != nil && (*ds.RangeRequestHandling
== tc.RangeRequestHandlingCacheRangeRequest || *ds.RangeRequestHandling ==
tc.RangeRequestHandlingSlice) {
- remapTags.RangeRequests =
`@plugin=cache_range_requests.so` +
-
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
+ crrParam :=
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
+ remapTags.RangeRequests =
`@plugin=cache_range_requests.so` + crrParam
+ if *ds.RangeRequestHandling ==
tc.RangeRequestHandlingSlice && !strings.Contains(crrParam, "--consider-ims")
&& selfHeal {
+ remapTags.RangeRequests += `
@pparam=--consider-ims`
+ }
}
isLastCache, err := serverIsLastCacheForDS(server, &ds,
nameTopologies, cacheGroups)
@@ -694,7 +707,7 @@ func buildEdgeRemapLine(
remapTags.HeaderRewrite = `@plugin=header_rewrite.so @pparam=`
+ edgeHeaderRewriteConfigFileName(ds.XMLID)
}
- dsConfigParamsMap := classifyConfigParams(remapConfigParams)
+ dsConfigParamsMap, selfHeal := classifyConfigParams(remapConfigParams)
if ds.SigningAlgorithm != nil && *ds.SigningAlgorithm != "" {
if *ds.SigningAlgorithm == tc.SigningAlgorithmURLSig {
@@ -772,8 +785,10 @@ func buildEdgeRemapLine(
}
if crr {
- rangeReqTxt += `@plugin=cache_range_requests.so ` +
-
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
+ rangeReqTxt += `@plugin=cache_range_requests.so ` +
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
+ if *ds.RangeRequestHandling ==
tc.RangeRequestHandlingSlice && !strings.Contains(rangeReqTxt,
"--consider-ims") && selfHeal {
+ rangeReqTxt += ` @pparam=--consider-ims`
+ }
}
}
diff --git a/lib/go-atscfg/remapdotconfig_test.go
b/lib/go-atscfg/remapdotconfig_test.go
index 5776656703..2a9502d4f6 100644
--- a/lib/go-atscfg/remapdotconfig_test.go
+++ b/lib/go-atscfg/remapdotconfig_test.go
@@ -1599,7 +1599,7 @@ func
TestMakeRemapDotConfigMidSlicePluginRangeRequestHandling(t *testing.T) {
ds.Active = tc.DSActiveStateActive
ds2 := DeliveryService{}
- ds2.ID = util.Ptr(48)
+ ds2.ID = util.Ptr(50)
dsType2 := "HTTP_LIVE_NATNL"
ds2.Type = &dsType2
ds2.OrgServerFQDN = util.Ptr("origin.example.test")
@@ -1629,6 +1629,10 @@ func
TestMakeRemapDotConfigMidSlicePluginRangeRequestHandling(t *testing.T) {
Server: server.ID,
DeliveryService: *ds.ID,
},
+ DeliveryServiceServer{
+ Server: server.ID,
+ DeliveryService: *ds2.ID,
+ },
}
dsRegexes := []tc.DeliveryServiceRegexes{
@@ -1687,6 +1691,9 @@ func
TestMakeRemapDotConfigMidSlicePluginRangeRequestHandling(t *testing.T) {
txt = strings.TrimSpace(txt)
+ if !strings.Contains(txt, "@pparam=--consider-ims") {
+ t.Errorf("expected '--consider-ims' param with
'cache_range_requests.so' when using slice plugin to enable self healing,
actual: %s", txt)
+ }
testComment(t, txt, hdr)
txtLines := strings.Split(txt, "\n")
@@ -5562,11 +5569,160 @@ func TestMakeRemapDotConfigEdgeRangeRequestSlice(t
*testing.T) {
t.Errorf("expected remap on edge server with ds slice range
request handling to contain cache_range_requests plugin, actual '%v'", txt)
}
+ if !strings.Contains(remapLine, "@pparam=--consider-ims") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain parameter --consider-ims for self healing, actual
'%s", txt)
+ }
+
if !strings.Contains(remapLine, "pparam=--blockbytes=262144") {
t.Errorf("expected remap on edge server with ds slice range
request handling to contain block size for the slice plugin, actual '%v'", txt)
}
}
+func TestMakeRemapDotConfigMidRangeRequestSliceNoAutoSelfHeal(t *testing.T) {
+ hdr := "myHeaderComment"
+
+ server := makeTestRemapServer()
+ server.Type = "MID"
+ servers := []Server{}
+
+ ds := DeliveryService{}
+ ds.ID = util.Ptr(48)
+ dsType := "HTTP_LIVE_NATNL"
+ ds.Type = &dsType
+ ds.OrgServerFQDN = util.Ptr("origin.example.test")
+ ds.MidHeaderRewrite = util.Ptr("")
+ ds.RangeRequestHandling = util.Ptr(tc.RangeRequestHandlingSlice)
+ ds.RemapText = util.Ptr("myremaptext")
+ ds.EdgeHeaderRewrite = nil
+ ds.SigningAlgorithm = util.Ptr("foo")
+ ds.XMLID = "mydsname"
+ ds.QStringIgnore =
util.Ptr(int(tc.QueryStringIgnoreIgnoreInCacheKeyAndPassUp))
+ ds.RegexRemap = util.Ptr("")
+ ds.FQPacingRate = util.Ptr(0)
+ ds.DSCP = 0
+ ds.RoutingName = "myroutingname"
+ ds.MultiSiteOrigin = false
+ ds.OriginShield = util.Ptr("myoriginshield")
+ ds.ProfileID = util.Ptr(49)
+ ds.ProfileName = util.Ptr("dsprofile")
+ ds.Protocol = util.Ptr(int(tc.DSProtocolHTTPToHTTPS))
+ ds.AnonymousBlockingEnabled = false
+ ds.Active = tc.DSActiveStateActive
+ ds.RangeSliceBlockSize = util.Ptr(262144)
+
+ dses := []DeliveryService{ds}
+
+ dss := []DeliveryServiceServer{
+ DeliveryServiceServer{
+ Server: server.ID,
+ DeliveryService: *ds.ID,
+ },
+ }
+
+ dsRegexes := []tc.DeliveryServiceRegexes{
+ tc.DeliveryServiceRegexes{
+ DSName: ds.XMLID,
+ Regexes: []tc.DeliveryServiceRegex{
+ tc.DeliveryServiceRegex{
+ Type:
string(tc.DSMatchTypeHostRegex),
+ SetNumber: 0,
+ Pattern:
`myliteralpattern__http__foo`,
+ },
+ },
+ },
+ }
+
+ serverParams := []tc.ParameterV5{
+ tc.ParameterV5{
+ Name: "trafficserver",
+ ConfigFile: "package",
+ Value: "9",
+ Profiles: []byte(`["global"]`),
+ },
+ tc.ParameterV5{
+ Name: "serverpkgval",
+ ConfigFile: "package",
+ Value: "serverpkgval __HOSTNAME__ foo",
+ Profiles: []byte(server.Profiles[0]),
+ },
+ tc.ParameterV5{
+ Name: "dscp_remap_no",
+ ConfigFile: "package",
+ Value: "notused",
+ Profiles: []byte(server.Profiles[0]),
+ },
+ }
+
+ remapConfigParams := []tc.ParameterV5{
+ tc.ParameterV5{
+ Name: "not_location",
+ ConfigFile: "cachekey.config",
+ Value: "notinconfig",
+ Profiles: []byte(`["global"]`),
+ },
+ tc.ParameterV5{
+ Name: "cache_range_requests.pparam",
+ ConfigFile: "remap.config",
+ Value: selfHealParam,
+ Profiles: []byte(`["dsprofile"]`),
+ },
+ }
+
+ cdn := &tc.CDNV5{
+ DomainName: "cdndomain.example",
+ Name: "my-cdn-name",
+ }
+
+ topologies := []tc.TopologyV5{}
+ cgs := []tc.CacheGroupNullableV5{}
+ serverCapabilities := map[int]map[ServerCapability]struct{}{}
+ dsRequiredCapabilities := map[int]map[ServerCapability]struct{}{}
+ configDir := `/opt/trafficserver/etc/trafficserver`
+
+ cfg, err := MakeRemapDotConfig(server, servers, dses, dss, dsRegexes,
serverParams, cdn, remapConfigParams, topologies, cgs, serverCapabilities,
dsRequiredCapabilities, configDir, &RemapDotConfigOpts{HdrComment: hdr})
+ if err != nil {
+ t.Fatal(err)
+ }
+ txt := cfg.Text
+
+ txt = strings.TrimSpace(txt)
+
+ testComment(t, txt, hdr)
+
+ txtLines := strings.Split(txt, "\n")
+
+ if len(txtLines) != 3 { // comment, blank, and remap
+ t.Fatalf("expected a comment header, a blank line, and 1 remaps
from HTTP_TO_HTTPS DS, actual: '%v' count %v", txt, len(txtLines))
+ }
+
+ remapLine := txtLines[2]
+ words := strings.Fields(remapLine)
+ if !strings.HasPrefix(remapLine, "map") {
+ t.Errorf("expected to start with 'map', actual '%v'", txt)
+ }
+
+ if strings.Contains(remapLine, "slice.so") {
+ t.Errorf("did not expected remap on mid server with ds slice
range request handling to contain slice plugin, actual '%v'", txt)
+ }
+
+ if !strings.Contains(remapLine, "cache_range_requests.so") {
+ t.Errorf("expected remap on mid server with ds slice range
request handling to contain cache_range_requests plugin, actual '%v'", txt)
+ }
+
+ if strings.Contains(remapLine, "--consider-ims") {
+ t.Errorf("expected remap on mid server with ds slice range
request handling and '%s' param to not contain cache_range_requests plugin arg
--consider-ims, actual '%v'", selfHealParam, txt)
+ }
+
+ if strings.Contains(remapLine, "pparam=--blockbytes") {
+ t.Errorf("did not expected remap on edge server with ds slice
range request handling to contain block size for the slice plugin, actual
'%v'", txt)
+ }
+ for _, word := range words {
+ if word == "@pparam=" {
+ t.Errorf("expected remap on mid server with empty
'cache_range_requests.pparam' to be skipped and not have empty '@pparam=' on
remapline, actual %s", txt)
+ }
+ }
+}
+
func TestMakeRemapDotConfigMidRangeRequestSlicePparam(t *testing.T) {
hdr := "myHeaderComment"
@@ -5685,7 +5841,7 @@ func TestMakeRemapDotConfigMidRangeRequestSlicePparam(t
*testing.T) {
}
remapLine := txtLines[2]
-
+ words := strings.Fields(remapLine)
if !strings.HasPrefix(remapLine, "map") {
t.Errorf("expected to start with 'map', actual '%v'", txt)
}
@@ -5705,9 +5861,14 @@ func TestMakeRemapDotConfigMidRangeRequestSlicePparam(t
*testing.T) {
if strings.Contains(remapLine, "pparam=--blockbytes") {
t.Errorf("did not expected remap on edge server with ds slice
range request handling to contain block size for the slice plugin, actual
'%v'", txt)
}
+ for _, word := range words {
+ if word == "@pparam=" {
+ t.Errorf("expected remap on mid server with empty
'cache_range_requests.pparam' to be skipped and not have empty '@pparam=' on
remapline, actual %s", txt)
+ }
+ }
}
-func TestMakeRemapDotConfigEdgeRangeRequestSlicePparam(t *testing.T) {
+func TestMakeRemapDotConfigEdgeRangeRequestSliceNoAutoSelfHeal(t *testing.T) {
hdr := "myHeaderComment"
server := makeTestRemapServer()
@@ -5786,9 +5947,163 @@ func
TestMakeRemapDotConfigEdgeRangeRequestSlicePparam(t *testing.T) {
tc.ParameterV5{
Name: "cache_range_requests.pparam",
ConfigFile: "remap.config",
- Value: "--consider-ims",
+ Value: "--no-modify-cachekey",
Profiles: []byte(`["dsprofile"]`),
},
+ tc.ParameterV5{
+ Name: "not_location",
+ ConfigFile: "cachekey.config",
+ Value: "notinconfig",
+ Profiles: []byte(`["global"]`),
+ },
+ tc.ParameterV5{
+ Name: "cache_range_requests.pparam",
+ ConfigFile: "remap.config",
+ Value: selfHealParam,
+ Profiles: []byte(`["dsprofile"]`),
+ },
+ }
+
+ cdn := &tc.CDNV5{
+ DomainName: "cdndomain.example",
+ Name: "my-cdn-name",
+ }
+
+ topologies := []tc.TopologyV5{}
+ cgs := []tc.CacheGroupNullableV5{}
+ serverCapabilities := map[int]map[ServerCapability]struct{}{}
+ dsRequiredCapabilities := map[int]map[ServerCapability]struct{}{}
+ configDir := `/opt/trafficserver/etc/trafficserver`
+
+ cfg, err := MakeRemapDotConfig(server, servers, dses, dss, dsRegexes,
serverParams, cdn, remapConfigParams, topologies, cgs, serverCapabilities,
dsRequiredCapabilities, configDir, &RemapDotConfigOpts{HdrComment: hdr})
+ if err != nil {
+ t.Fatal(err)
+ }
+ txt := cfg.Text
+
+ txt = strings.TrimSpace(txt)
+
+ testComment(t, txt, hdr)
+
+ txtLines := strings.Split(txt, "\n")
+
+ if len(txtLines) != 3 { // comment, blank, and remap
+ t.Fatalf("expected a comment header, a blank line, and 1 remaps
from HTTP_TO_HTTPS DS, actual: '%v' count %v", txt, len(txtLines))
+ }
+
+ remapLine := txtLines[2]
+ words := strings.Fields(remapLine)
+
+ if !strings.HasPrefix(remapLine, "map") {
+ t.Errorf("expected to start with 'map', actual '%v'", txt)
+ }
+
+ if 1 != strings.Count(remapLine, "cachekey.so") {
+ t.Errorf("expected remap on edge server to contain a single
cachekey plugin, actual '%v'", txt)
+ }
+
+ if !strings.Contains(remapLine, "slice.so") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain background fetch plugin, actual '%v'", txt)
+ }
+
+ if !strings.Contains(remapLine, "cache_range_requests.so") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain cache_range_requests plugin, actual '%v'", txt)
+ }
+
+ if strings.Contains(remapLine, "--consider-ims") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling and '%s' param to not contain cache_range_requests plugin arg
--consider-ims, actual '%v'", selfHealParam, txt)
+ }
+
+ if !strings.Contains(remapLine, "--no-modify-cachekey") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain cache_range_requests plugin arg
--no-modify-cachekey, actual '%v'", txt)
+ }
+
+ if !strings.Contains(remapLine, "pparam=--blockbytes=262144") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain block size for the slice plugin, actual '%v'", txt)
+ }
+ for _, word := range words {
+ if word == "@pparam=" {
+ t.Errorf("expected remap on edge server with empty
'cache_range_requests.pparam' to be skipped and not have empty '@pparam=' on
remapline, actual %s", txt)
+ }
+ }
+}
+
+func TestMakeRemapDotConfigEdgeRangeRequestSlicePparam(t *testing.T) {
+ hdr := "myHeaderComment"
+
+ server := makeTestRemapServer()
+ server.Type = "EDGE"
+ servers := []Server{}
+
+ ds := DeliveryService{}
+ ds.ID = util.Ptr(48)
+ dsType := "HTTP_LIVE_NATNL"
+ ds.Type = &dsType
+ ds.OrgServerFQDN = util.Ptr("origin.example.test")
+ ds.MidHeaderRewrite = util.Ptr("")
+ ds.RangeRequestHandling = util.Ptr(tc.RangeRequestHandlingSlice)
+ ds.RemapText = util.Ptr("myremaptext")
+ ds.EdgeHeaderRewrite = nil
+ ds.SigningAlgorithm = util.Ptr("foo")
+ ds.XMLID = "mydsname"
+ ds.QStringIgnore =
util.Ptr(int(tc.QueryStringIgnoreIgnoreInCacheKeyAndPassUp))
+ ds.RegexRemap = util.Ptr("")
+ ds.FQPacingRate = util.Ptr(0)
+ ds.DSCP = 0
+ ds.RoutingName = "myroutingname"
+ ds.MultiSiteOrigin = false
+ ds.OriginShield = util.Ptr("myoriginshield")
+ ds.ProfileID = util.Ptr(49)
+ ds.ProfileName = util.Ptr("dsprofile")
+ ds.Protocol = util.Ptr(int(tc.DSProtocolHTTPToHTTPS))
+ ds.AnonymousBlockingEnabled = false
+ ds.Active = tc.DSActiveStateActive
+ ds.RangeSliceBlockSize = util.Ptr(262144)
+
+ dses := []DeliveryService{ds}
+
+ dss := []DeliveryServiceServer{
+ DeliveryServiceServer{
+ Server: server.ID,
+ DeliveryService: *ds.ID,
+ },
+ }
+
+ dsRegexes := []tc.DeliveryServiceRegexes{
+ tc.DeliveryServiceRegexes{
+ DSName: ds.XMLID,
+ Regexes: []tc.DeliveryServiceRegex{
+ tc.DeliveryServiceRegex{
+ Type:
string(tc.DSMatchTypeHostRegex),
+ SetNumber: 0,
+ Pattern:
`myliteralpattern__http__foo`,
+ },
+ },
+ },
+ }
+
+ serverParams := []tc.ParameterV5{
+ tc.ParameterV5{
+ Name: "trafficserver",
+ ConfigFile: "package",
+ Value: "9",
+ Profiles: []byte(`["global"]`),
+ },
+ tc.ParameterV5{
+ Name: "serverpkgval",
+ ConfigFile: "package",
+ Value: "serverpkgval __HOSTNAME__ foo",
+ Profiles: []byte(server.Profiles[0]),
+ },
+ tc.ParameterV5{
+ Name: "dscp_remap_no",
+ ConfigFile: "package",
+ Value: "notused",
+ Profiles: []byte(server.Profiles[0]),
+ },
+ }
+
+ remapConfigParams := []tc.ParameterV5{
tc.ParameterV5{
Name: "cache_range_requests.pparam",
ConfigFile: "remap.config",
@@ -5831,6 +6146,8 @@ func TestMakeRemapDotConfigEdgeRangeRequestSlicePparam(t
*testing.T) {
}
remapLine := txtLines[2]
+ t.Log(remapLine)
+ words := strings.Fields(remapLine)
if !strings.HasPrefix(remapLine, "map") {
t.Errorf("expected to start with 'map', actual '%v'", txt)
@@ -5859,6 +6176,11 @@ func TestMakeRemapDotConfigEdgeRangeRequestSlicePparam(t
*testing.T) {
if !strings.Contains(remapLine, "pparam=--blockbytes=262144") {
t.Errorf("expected remap on edge server with ds slice range
request handling to contain block size for the slice plugin, actual '%v'", txt)
}
+ for _, word := range words {
+ if word == "@pparam=" {
+ t.Errorf("expected remap on edge server with empty
'cache_range_requests.pparam' to be skipped and not have empty '@pparam=' on
remapline, actual %s", txt)
+ }
+ }
}
func TestMakeRemapDotConfigRawRemapRangeDirective(t *testing.T) {
@@ -6409,6 +6731,10 @@ func
TestMakeRemapDotConfigRawRemapWithoutRangeDirective(t *testing.T) {
t.Errorf("expected remap on edge server with ds slice range
request handling to contain block size for the slice plugin, actual '%v'", txt)
}
+ if !strings.Contains(remapLine, "@pparam=--consider-ims") {
+ t.Errorf("expected remap on edge server with ds slice range
request handling to contain --consider-ims for self-healing, actual '%v'", txt)
+ }
+
if !strings.HasSuffix(remapLine, "@plugin=tslua.so
@pparam=my-range-manipulator.lua # ds 'mydsname' topology ''") {
t.Errorf("expected raw remap without range directive at end of
remap line, actual '%v'", txt)
}