[trafficserver-ingress-controller] branch master updated: Adds boilerplate code for testing

2020-07-20 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
 new cb7fcef  Adds boilerplate code for testing
 new 380e3c4  Merge pull request #10 from rishabhc/cicd_pipeline
cb7fcef is described below

commit cb7fcefc55cd906ab3ecc0306744b6e8678c3885
Author: Rishabh Chhabra 
AuthorDate: Mon Jun 22 22:48:41 2020 -0500

Adds boilerplate code for testing

Completes one basic test for adding services in redis

Adds function to fetch all key value pairs in redis db one

Adds another path for testing and adds checking for key value map equality

Adds tests for add and update with annotation

Adds TLS tests and updates update tests

Adds tests for handlerIngress for namespaces

Adds tests for handlerEndpoint

Adds tests for endpoint handler

Adds initial tests for reddit

Adds all tests for Redis

Adds lua unit tests for plugin

Modifies clientset to use interface to enable testing

Adds test for configmap handler

Adds method to get ATS config

Modifies watcher to be compatible to unit testing. Adds watcher tests

Adds function to test for map similarity

Replaces deepequal check with map similarity check

Adds configmaps informer to watcher

Adds tests for configmap informers

Adds license to new files

Modifies test to implement unit testing without the need for external 
libraries

Adds mock for redis for unit testing

Adds fakeATSmanager

Modifies configmap tests to use fakeATS

Modifies watcher to use fake ATS

Gets namespace from ATS Interface

Adds instructions to run unit tests

Adds breaks in README

adds warning to readme

adds warning to readme
---
 README.md|  12 ++
 endpoint/endpoint.go |   2 +-
 go.mod   |   1 +
 namespace/namespace.go   |   4 +
 pluginats/connect_redis_test.lua | 153 ++
 proxy/ats.go |  18 ++
 proxy/{ats.go => fakeATS.go} |  27 ++-
 redis/redis.go   | 107 ++
 redis/redis_test.go  | 199 +++
 util/util.go |  62 ++
 watcher/handlerConfigmap_test.go | 145 ++
 watcher/handlerEndpoint_test.go  | 256 
 watcher/handlerIngress_test.go   | 400 +
 watcher/watcher.go   |  54 +++--
 watcher/watcher_test.go  | 419 +++
 15 files changed, 1832 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index 165d13a..05cde09 100644
--- a/README.md
+++ b/README.md
@@ -291,6 +291,18 @@ Use the following steps to install Prometheus and Grafana 
and use them to monito
 ### Compilation
 To compile, while in `ingress-ats/` directory: `go build -o ingress_ats 
main/main.go`
 
+### Unit Tests
+The project includes unit tests for the controller written in Golang and the 
plugin written in Lua.
+
+To run the Golang unit tests: `go test ./watcher/ && go test ./redis/`
+
+The Lua unit tests use `busted` for testing. `busted` can be installed using 
`luarocks`:`luarocks install busted`. More information on how to install busted 
is available [here](https://olivinelabs.com/busted/). 
+> :warning: **Note that the project uses Lua 5.1 version**
+
+To run the Lua unit tests: 
+- `cd pluginats`
+- `busted connect_redis_test.lua` 
+
 ### Text-Editor
 The repository comes with basic support for both 
[vscode](https://code.visualstudio.com/) and `vim`. 
 
diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go
index 516fa57..73fc74d 100644
--- a/endpoint/endpoint.go
+++ b/endpoint/endpoint.go
@@ -43,6 +43,6 @@ const (
 // Endpoint stores all essential information to act on HostGroups
 type Endpoint struct {
RedisClient *redis.Client
-   ATSManager  *proxy.ATSManager
+   ATSManager  proxy.ATSManagerInterface
NsManager   *namespace.NsManager
 }
diff --git a/go.mod b/go.mod
index 3dc085c..b04380f 100644
--- a/go.mod
+++ b/go.mod
@@ -17,4 +17,5 @@ require (
k8s.io/client-go v0.0.0-20190626045420-1ec4b74c7bda
k8s.io/klog v0.3.3 // indirect
k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect
+   github.com/alicebob/miniredis/v2 v2.13.0
 )
diff --git a/namespace/namespace.go b/namespace/namespace.go
index e6030e3..7b09ac0 100644
--- a/namespace/namespace.go
+++ b/namespace/namespace.go
@@ -51,3 +51,7 @@ func (m *NsManager) Init() {
m.allNamespaces = false
}
 }
+
+func (m *NsManager) DisableAllNamespaces() {
+   m.allNamespaces = false
+}
diff --git 

[trafficserver-ingress-controller] branch master updated: Adds boilerplate code for testing

2020-07-20 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
 new cb7fcef  Adds boilerplate code for testing
 new 380e3c4  Merge pull request #10 from rishabhc/cicd_pipeline
cb7fcef is described below

commit cb7fcefc55cd906ab3ecc0306744b6e8678c3885
Author: Rishabh Chhabra 
AuthorDate: Mon Jun 22 22:48:41 2020 -0500

Adds boilerplate code for testing

Completes one basic test for adding services in redis

Adds function to fetch all key value pairs in redis db one

Adds another path for testing and adds checking for key value map equality

Adds tests for add and update with annotation

Adds TLS tests and updates update tests

Adds tests for handlerIngress for namespaces

Adds tests for handlerEndpoint

Adds tests for endpoint handler

Adds initial tests for reddit

Adds all tests for Redis

Adds lua unit tests for plugin

Modifies clientset to use interface to enable testing

Adds test for configmap handler

Adds method to get ATS config

Modifies watcher to be compatible to unit testing. Adds watcher tests

Adds function to test for map similarity

Replaces deepequal check with map similarity check

Adds configmaps informer to watcher

Adds tests for configmap informers

Adds license to new files

Modifies test to implement unit testing without the need for external 
libraries

Adds mock for redis for unit testing

Adds fakeATSmanager

Modifies configmap tests to use fakeATS

Modifies watcher to use fake ATS

Gets namespace from ATS Interface

Adds instructions to run unit tests

Adds breaks in README

adds warning to readme

adds warning to readme
---
 README.md|  12 ++
 endpoint/endpoint.go |   2 +-
 go.mod   |   1 +
 namespace/namespace.go   |   4 +
 pluginats/connect_redis_test.lua | 153 ++
 proxy/ats.go |  18 ++
 proxy/{ats.go => fakeATS.go} |  27 ++-
 redis/redis.go   | 107 ++
 redis/redis_test.go  | 199 +++
 util/util.go |  62 ++
 watcher/handlerConfigmap_test.go | 145 ++
 watcher/handlerEndpoint_test.go  | 256 
 watcher/handlerIngress_test.go   | 400 +
 watcher/watcher.go   |  54 +++--
 watcher/watcher_test.go  | 419 +++
 15 files changed, 1832 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index 165d13a..05cde09 100644
--- a/README.md
+++ b/README.md
@@ -291,6 +291,18 @@ Use the following steps to install Prometheus and Grafana 
and use them to monito
 ### Compilation
 To compile, while in `ingress-ats/` directory: `go build -o ingress_ats 
main/main.go`
 
+### Unit Tests
+The project includes unit tests for the controller written in Golang and the 
plugin written in Lua.
+
+To run the Golang unit tests: `go test ./watcher/ && go test ./redis/`
+
+The Lua unit tests use `busted` for testing. `busted` can be installed using 
`luarocks`:`luarocks install busted`. More information on how to install busted 
is available [here](https://olivinelabs.com/busted/). 
+> :warning: **Note that the project uses Lua 5.1 version**
+
+To run the Lua unit tests: 
+- `cd pluginats`
+- `busted connect_redis_test.lua` 
+
 ### Text-Editor
 The repository comes with basic support for both 
[vscode](https://code.visualstudio.com/) and `vim`. 
 
diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go
index 516fa57..73fc74d 100644
--- a/endpoint/endpoint.go
+++ b/endpoint/endpoint.go
@@ -43,6 +43,6 @@ const (
 // Endpoint stores all essential information to act on HostGroups
 type Endpoint struct {
RedisClient *redis.Client
-   ATSManager  *proxy.ATSManager
+   ATSManager  proxy.ATSManagerInterface
NsManager   *namespace.NsManager
 }
diff --git a/go.mod b/go.mod
index 3dc085c..b04380f 100644
--- a/go.mod
+++ b/go.mod
@@ -17,4 +17,5 @@ require (
k8s.io/client-go v0.0.0-20190626045420-1ec4b74c7bda
k8s.io/klog v0.3.3 // indirect
k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect
+   github.com/alicebob/miniredis/v2 v2.13.0
 )
diff --git a/namespace/namespace.go b/namespace/namespace.go
index e6030e3..7b09ac0 100644
--- a/namespace/namespace.go
+++ b/namespace/namespace.go
@@ -51,3 +51,7 @@ func (m *NsManager) Init() {
m.allNamespaces = false
}
 }
+
+func (m *NsManager) DisableAllNamespaces() {
+   m.allNamespaces = false
+}
diff --git 

[trafficserver-ingress-controller] branch master updated: Adds github action workflows for testing and building

2020-07-20 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
 new ba31f09  Adds github action workflows for testing and building
 new 009877f  Merge pull request #11 from rishabhc/cicd-githubactions
ba31f09 is described below

commit ba31f0960a8807f2a56f8c20a5a15fad78d6e28e
Author: Rishabh Chhabra 
AuthorDate: Fri Jul 17 19:34:12 2020 -0500

Adds github action workflows for testing and building
---
 .github/workflows/build.yml | 18 +
 .github/workflows/test.yml  | 48 +
 build-master.sh | 12 
 3 files changed, 78 insertions(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000..44fdebb
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,18 @@
+name: Build
+
+on:
+  push:
+branches:
+  - 'master'
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+steps:
+- name: Checkout repository
+  uses: actions/checkout@v2
+- name: Build and push
+  run: ./build-master.sh
+  # env:
+  #   QUAY_USERNAME: ${{  secrets.QUAY_USERNAME }}
+  #   QUAY_PASSWORD: ${{  secrets.QUAY_PASSWORD }}
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000..e361553
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,48 @@
+name: Test
+
+on: [push, pull_request]
+
+jobs:
+
+  build:
+name: Test Redis and Lua
+runs-on: ubuntu-latest
+steps:
+
+- name: Set up Go 1.x
+  uses: actions/setup-go@v2
+  with:
+go-version: ^1.13
+  id: go
+
+- name: Check out code into the Go module directory
+  uses: actions/checkout@v2
+
+- uses: leafo/gh-actions-lua@v6
+  with:
+luaVersion: "5.1.5"
+
+- uses: leafo/gh-actions-luarocks@v2
+
+- name: Install Busted
+  run: |
+luarocks install busted
+
+- name: Get dependencies
+  run: |
+go get -v -t -d ./...
+if [ -f Gopkg.toml ]; then
+curl 
https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
+dep ensure
+fi
+
+- name: Test Watcher
+  run: go test -v ./watcher/
+
+- name: Test Redis
+  run: go test -v ./redis/
+
+- name: Test RedisPluginATS
+  run: |
+cd pluginats
+../.luarocks/bin/busted connect_redis_test.lua
\ No newline at end of file
diff --git a/build-master.sh b/build-master.sh
new file mode 100644
index 000..ad5d5ef
--- /dev/null
+++ b/build-master.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+
+# build
+REPONAME="ats-ingress"
+TAG="latest"
+#TARGET="quay.io"/${QUAY_USERNAME}/${REPONAME}:${TAG}
+TARGET="ats-ingress:latest"
+#echo ${TARGET}
+
+#echo "${QUAY_PASSWORD}" | docker login -u "${QUAY_USERNAME}" quay.io 
--password-stdin
+docker build -t ${TARGET} .
+#docker push ${TARGET}
\ No newline at end of file



[trafficserver-ingress-controller] branch master updated: Adds boilerplate code for testing

2020-07-20 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
 new cb7fcef  Adds boilerplate code for testing
 new 380e3c4  Merge pull request #10 from rishabhc/cicd_pipeline
cb7fcef is described below

commit cb7fcefc55cd906ab3ecc0306744b6e8678c3885
Author: Rishabh Chhabra 
AuthorDate: Mon Jun 22 22:48:41 2020 -0500

Adds boilerplate code for testing

Completes one basic test for adding services in redis

Adds function to fetch all key value pairs in redis db one

Adds another path for testing and adds checking for key value map equality

Adds tests for add and update with annotation

Adds TLS tests and updates update tests

Adds tests for handlerIngress for namespaces

Adds tests for handlerEndpoint

Adds tests for endpoint handler

Adds initial tests for reddit

Adds all tests for Redis

Adds lua unit tests for plugin

Modifies clientset to use interface to enable testing

Adds test for configmap handler

Adds method to get ATS config

Modifies watcher to be compatible to unit testing. Adds watcher tests

Adds function to test for map similarity

Replaces deepequal check with map similarity check

Adds configmaps informer to watcher

Adds tests for configmap informers

Adds license to new files

Modifies test to implement unit testing without the need for external 
libraries

Adds mock for redis for unit testing

Adds fakeATSmanager

Modifies configmap tests to use fakeATS

Modifies watcher to use fake ATS

Gets namespace from ATS Interface

Adds instructions to run unit tests

Adds breaks in README

adds warning to readme

adds warning to readme
---
 README.md|  12 ++
 endpoint/endpoint.go |   2 +-
 go.mod   |   1 +
 namespace/namespace.go   |   4 +
 pluginats/connect_redis_test.lua | 153 ++
 proxy/ats.go |  18 ++
 proxy/{ats.go => fakeATS.go} |  27 ++-
 redis/redis.go   | 107 ++
 redis/redis_test.go  | 199 +++
 util/util.go |  62 ++
 watcher/handlerConfigmap_test.go | 145 ++
 watcher/handlerEndpoint_test.go  | 256 
 watcher/handlerIngress_test.go   | 400 +
 watcher/watcher.go   |  54 +++--
 watcher/watcher_test.go  | 419 +++
 15 files changed, 1832 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index 165d13a..05cde09 100644
--- a/README.md
+++ b/README.md
@@ -291,6 +291,18 @@ Use the following steps to install Prometheus and Grafana 
and use them to monito
 ### Compilation
 To compile, while in `ingress-ats/` directory: `go build -o ingress_ats 
main/main.go`
 
+### Unit Tests
+The project includes unit tests for the controller written in Golang and the 
plugin written in Lua.
+
+To run the Golang unit tests: `go test ./watcher/ && go test ./redis/`
+
+The Lua unit tests use `busted` for testing. `busted` can be installed using 
`luarocks`:`luarocks install busted`. More information on how to install busted 
is available [here](https://olivinelabs.com/busted/). 
+> :warning: **Note that the project uses Lua 5.1 version**
+
+To run the Lua unit tests: 
+- `cd pluginats`
+- `busted connect_redis_test.lua` 
+
 ### Text-Editor
 The repository comes with basic support for both 
[vscode](https://code.visualstudio.com/) and `vim`. 
 
diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go
index 516fa57..73fc74d 100644
--- a/endpoint/endpoint.go
+++ b/endpoint/endpoint.go
@@ -43,6 +43,6 @@ const (
 // Endpoint stores all essential information to act on HostGroups
 type Endpoint struct {
RedisClient *redis.Client
-   ATSManager  *proxy.ATSManager
+   ATSManager  proxy.ATSManagerInterface
NsManager   *namespace.NsManager
 }
diff --git a/go.mod b/go.mod
index 3dc085c..b04380f 100644
--- a/go.mod
+++ b/go.mod
@@ -17,4 +17,5 @@ require (
k8s.io/client-go v0.0.0-20190626045420-1ec4b74c7bda
k8s.io/klog v0.3.3 // indirect
k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect
+   github.com/alicebob/miniredis/v2 v2.13.0
 )
diff --git a/namespace/namespace.go b/namespace/namespace.go
index e6030e3..7b09ac0 100644
--- a/namespace/namespace.go
+++ b/namespace/namespace.go
@@ -51,3 +51,7 @@ func (m *NsManager) Init() {
m.allNamespaces = false
}
 }
+
+func (m *NsManager) DisableAllNamespaces() {
+   m.allNamespaces = false
+}
diff --git 

[trafficserver] branch 9.0.x updated: Updated ChangeLog

2020-07-20 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 26015ca  Updated ChangeLog
26015ca is described below

commit 26015cad193761f9d0cda890e1d3f44521ba4c67
Author: Bryan Call 
AuthorDate: Mon Jul 20 15:29:23 2020 -0700

Updated ChangeLog
---
 CHANGELOG-9.0.0 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG-9.0.0 b/CHANGELOG-9.0.0
index 42ad20c..e6f7b1c 100644
--- a/CHANGELOG-9.0.0
+++ b/CHANGELOG-9.0.0
@@ -1004,3 +1004,5 @@ Changes with Apache Traffic Server 9.0.0
   #6977 - Preserve cert name through ssl vc migration
   #6984 - Fix out of source tree builds for QUIC
   #6994 - Adds null check
+  #7004 - Fixed core when sending back a redirect and having an invalid server 
response
+  #7007 - Updates to thread scale factor



[trafficserver] branch 8.1.x updated: Update autest python version to 36 (#7013)

2020-07-20 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 59d3b9a  Update autest python version to 36 (#7013)
59d3b9a is described below

commit 59d3b9a363ccae3ce8337b272ef081c5bf495e59
Author: Evan Zelkowitz 
AuthorDate: Mon Jul 20 14:47:02 2020 -0700

Update autest python version to 36 (#7013)

This updates the needed version to 36 since it appears some dependencies 
require it.  It also adds setuptools to be upgraded along with pip to resolve 
to build requirements issues

Bump autest version to 1.8.0
---
 tests/Pipfile  |  2 +-
 tests/autest.sh|  2 +-
 tests/bootstrap.py | 12 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/Pipfile b/tests/Pipfile
index b9a79bb..993b82b 100644
--- a/tests/Pipfile
+++ b/tests/Pipfile
@@ -24,7 +24,7 @@ autopep8 = "*"
 pyflakes = "*"
 
 [packages]
-autest = "==1.7.4"
+autest = "==1.8.0"
 traffic-replay = "*" # this should install TRLib, MicroServer, MicroDNS, 
Traffic-Replay
 hyper = "*"
 dnslib = "*"
diff --git a/tests/autest.sh b/tests/autest.sh
index 33c4d21..bbbfa80 100755
--- a/tests/autest.sh
+++ b/tests/autest.sh
@@ -27,7 +27,7 @@ if [ ! -f ./env-test/bin/autest ]; then\
 echo -e "${GREEN}Done!${NC}";\
fi
 # this is for rhel or centos systems
-test -r /opt/rh/rh-python35/enable && . /opt/rh/rh-python35/enable
+test -r /opt/rh/rh-python36/enable && . /opt/rh/rh-python36/enable
 . env-test/bin/activate
 ./env-test/bin/autest -D gold_tests "$@"
 ret=$?
diff --git a/tests/bootstrap.py b/tests/bootstrap.py
index 892345e..c352878 100755
--- a/tests/bootstrap.py
+++ b/tests/bootstrap.py
@@ -26,7 +26,7 @@ import platform
 import sys
 
 pip_packages = [
-"autest==1.7.3",
+"autest==1.8.0",
 "hyper",
 "requests",
 "dnslib",
@@ -39,8 +39,8 @@ pip_packages = [
 distro_packages = {
 "RHEL": [
 "install epel-release",
-"install python35",
-"install rh-python35-python-virtualenv"
+"install python36",
+"install rh-python36-python-virtualenv"
 ],
 "Fedora": [
 "install python3",
@@ -55,7 +55,7 @@ distro_packages = {
 ],
 "CentOS": [
 "install epel-release",
-"install rh-python35-python-virtualenv"
+"install rh-python36-python-virtualenv"
 ]
 }
 
@@ -169,7 +169,7 @@ def gen_package_cmds(packages):
 
 extra = ''
 if distro() == 'RHEL' or distro() == 'CentOS':
-extra = ". /opt/rh/rh-python35/enable ;"
+extra = ". /opt/rh/rh-python36/enable ;"
 
 
 def venv_cmds(path):
@@ -181,7 +181,7 @@ def venv_cmds(path):
 return [
 # first command only needed for rhel and centos systems at this time
 extra + " virtualenv --python=python3 {0}".format(path),
-extra + " {0}/bin/pip install pip --upgrade".format(path)
+extra + " {0}/bin/pip install pip setuptools --upgrade".format(path)
 ]
 
 



[trafficserver] branch master updated: Add memory_profile plugin (#7014)

2020-07-20 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new b85025d  Add memory_profile plugin (#7014)
b85025d is described below

commit b85025d55dace10e8e63c6e1c461571da4d45959
Author: Susan Hinrichs 
AuthorDate: Mon Jul 20 15:04:15 2020 -0500

Add memory_profile plugin (#7014)
---
 doc/admin-guide/plugins/index.en.rst   |   1 +
 doc/admin-guide/plugins/memory_profile.en.rst  | 106 
 plugins/Makefile.am|   1 +
 plugins/experimental/memory_profile/Makefile.inc   |  23 +
 .../experimental/memory_profile/memory_profile.cc  | 109 +
 5 files changed, 240 insertions(+)

diff --git a/doc/admin-guide/plugins/index.en.rst 
b/doc/admin-guide/plugins/index.en.rst
index 0e33121..6f73b82 100644
--- a/doc/admin-guide/plugins/index.en.rst
+++ b/doc/admin-guide/plugins/index.en.rst
@@ -158,6 +158,7 @@ directory of the |TS| source tree. Experimental plugins can 
be compiled by passi
JA3 Fingerprint 
Maxmind ACL 
Memcache 
+   Memory Profile 
Metalink 
Money Trace 
MP4 
diff --git a/doc/admin-guide/plugins/memory_profile.en.rst 
b/doc/admin-guide/plugins/memory_profile.en.rst
new file mode 100644
index 000..82537a1
--- /dev/null
+++ b/doc/admin-guide/plugins/memory_profile.en.rst
@@ -0,0 +1,106 @@
+Memory_profile Plugin
+*
+
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+
+This plugin listens for plugin msgs and invokes jemalloc control
+operations.
+
+Installation
+
+
+Add the following line to :file:`plugin.config`::
+
+memory_profile.so
+
+In addition, |TS| must be able to read jemalloc configuration
+information either through the ``JEMALLOC_CONF`` environment variable
+or via the string sym linked to ``/etc/malloc.conf``.
+
+For example, if the string below is in ``JEMALLOC_CONF`` or in the sym link 
string, it
+enables profiling and indicates that the memory dump prefix is 
``/tmp/jeprof``.::
+
+prof:true,prof_prefix:/tmp/jeprof
+
+Details on configuration jemalloc options at 
``.
+Changes to the configuration in ``JEMALLOC_CONF`` or ``/etc/malloc.conf`` 
require a process
+restart to pick up.
+
+Plugin Messages
+===
+
+The plugin responds to the following mesages sent via traffic_ctl.
+
+MessageAction
+== 
===
+activate   Start jemalloc profiling. Useful if prof_active:false was in the 
configure string.
+
+deactivate Stop jemalloc profiling.
+
+dump   If profiling is enabled and active, it will generate a profile dump 
file.
+
+stats  Print jemalloc statistics in traffic.out
+
+The command below sends the stats message to the plugin causing the current 
statistics to be written to traffic.out::
+
+traffic_ctl plugin msg memory_profile stats
+
+Example Usage
+=
+
+If your run time configuration string is::
+
+prof:true,prof_prefix:/tmp/jeprof:prof_active:false
+
+|TS| has started without profile sampling started.  Perhaps you didn't want to 
profile the start up phase of |TS|.  To start
+you need to send the activate message to the plugin::
+
+traffic_ctl plugin msg memory_profile activate
+
+If your run time configuration string does not indicate that the profiling is 
not started (e.g. the prof_active field is missing or set to true), you do not
+need to send the activate message.
+
+After waiting sometime for |TS| to gather some memory allocation data, you can 
send the dump message::
+
+traffic_ctl plugin msg memory_profile dump
+
+This will cause a file containing information about the current state of the 
|TS| memory allocation to be dumped in a file prefixed
+by the value of prof_prefix.  In this example, it would be something like 
``/tmp/jeprof.1234.0.m0.heap``, where 1234 is the process id
+and 0 is a running counter indicating how many dumps have been performed on 
this process.  Each dump is independent of the others
+and records 

[trafficserver] branch master updated: Fix typos relating to tls_bridge (#7011)

2020-07-20 Thread rrm
This is an automated email from the ASF dual-hosted git repository.

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new f6f389f  Fix typos relating to tls_bridge (#7011)
f6f389f is described below

commit f6f389f3c53d3a18877af5e737481429c51b06b1
Author: willwendorfvm <66445253+willwendor...@users.noreply.github.com>
AuthorDate: Mon Jul 20 13:26:51 2020 -0500

Fix typos relating to tls_bridge (#7011)
---
 doc/developer-guide/plugins/example-plugins/tls_bridge.en.rst | 2 +-
 plugins/experimental/tls_bridge/tls_bridge.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/developer-guide/plugins/example-plugins/tls_bridge.en.rst 
b/doc/developer-guide/plugins/example-plugins/tls_bridge.en.rst
index d2bcbc3..adebd92 100644
--- a/doc/developer-guide/plugins/example-plugins/tls_bridge.en.rst
+++ b/doc/developer-guide/plugins/example-plugins/tls_bridge.en.rst
@@ -101,7 +101,7 @@ useful case.
If this is unsuitable then an identity remap rule can be added for the peer 
|TS|. If the peer
|TS| was named "peer.ats" and it listens on port 4443, then the remap rule 
would be ::
 
-  remap https://peer.ats:4443 https://peer.ats:4443
+  map https://peer.ats:4443 https://peer.ats:4443
 
Remapping will be disabled for the user agent connection and so it will not 
need a rule.
 
diff --git a/plugins/experimental/tls_bridge/tls_bridge.cc 
b/plugins/experimental/tls_bridge/tls_bridge.cc
index 413b4aa..435af57 100644
--- a/plugins/experimental/tls_bridge/tls_bridge.cc
+++ b/plugins/experimental/tls_bridge/tls_bridge.cc
@@ -29,7 +29,7 @@ constexpr char const PLUGIN_NAME[] = "TLS Bridge";
 constexpr char const PLUGIN_TAG[]  = "tls_bridge";
 
 // Base format string for making the internal CONNECT.
-char const CONNECT_FORMAT[] = "CONNECT https:%.*s HTTP/1.1\r\n\r\n";
+char const CONNECT_FORMAT[] = "CONNECT https://%.*s HTTP/1.1\r\n\r\n";
 
 // TextView of the 'CONNECT' method string.
 const TextView METHOD_CONNECT{TS_HTTP_METHOD_CONNECT, TS_HTTP_LEN_CONNECT};



[trafficserver] branch 9.0.x updated: Updates to thread scale factor (#7007)

2020-07-20 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 72ef9dc  Updates to thread scale factor (#7007)
72ef9dc is described below

commit 72ef9dc62b259288b2b564fd0ab0c10d4cd9fbc6
Author: Bryan Call 
AuthorDate: Thu Jul 16 11:44:35 2020 -0700

Updates to thread scale factor (#7007)


(cherry picked from commit a76327e977a38ce6580addd3434158648448fe4f)
---
 configs/records.config.default.in | 2 +-
 doc/admin-guide/files/records.config.en.rst   | 4 ++--
 doc/admin-guide/performance/index.en.rst  | 2 +-
 doc/locale/ja/LC_MESSAGES/admin-guide/performance/index.en.po | 2 +-
 mgmt/RecordsConfig.cc | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configs/records.config.default.in 
b/configs/records.config.default.in
index 8f16382..23be6ce 100644
--- a/configs/records.config.default.in
+++ b/configs/records.config.default.in
@@ -9,7 +9,7 @@
 #https://docs.trafficserver.apache.org/records.config#thread-variables
 ##
 CONFIG proxy.config.exec_thread.autoconfig INT 1
-CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.5
+CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.0
 CONFIG proxy.config.exec_thread.limit INT 2
 CONFIG proxy.config.accept_threads INT 1
 CONFIG proxy.config.task_threads INT 2
diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 4299f5a..6e3d9fb 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -282,11 +282,11 @@ Thread Variables
When enabled (the default, ``1``), |TS| scales threads according to the
available CPU cores. See the config option below.
 
-.. ts:cv:: CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.5
+.. ts:cv:: CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.0
 
Factor by which |TS| scales the number of threads. The multiplier is usually
the number of available CPU cores. By default this is scaling factor is
-   ``1.5``.
+   ``1.0``.
 
 .. ts:cv:: CONFIG proxy.config.exec_thread.limit INT 2
 
diff --git a/doc/admin-guide/performance/index.en.rst 
b/doc/admin-guide/performance/index.en.rst
index 85c2f72..623cdae 100644
--- a/doc/admin-guide/performance/index.en.rst
+++ b/doc/admin-guide/performance/index.en.rst
@@ -182,7 +182,7 @@ CPU and Thread Optimization
 Thread Scaling
 ~~
 
-By default, |TS| creates 1.5 threads per CPU core on the host system. This may
+By default, |TS| creates one thread per CPU core on the host system. This may
 be adjusted with the following settings in :file:`records.config`:
 
 * :ts:cv:`proxy.config.exec_thread.autoconfig`
diff --git a/doc/locale/ja/LC_MESSAGES/admin-guide/performance/index.en.po 
b/doc/locale/ja/LC_MESSAGES/admin-guide/performance/index.en.po
index 6cb4bad..3e7de8b 100644
--- a/doc/locale/ja/LC_MESSAGES/admin-guide/performance/index.en.po
+++ b/doc/locale/ja/LC_MESSAGES/admin-guide/performance/index.en.po
@@ -231,7 +231,7 @@ msgstr ""
 
 #: ../../../admin-guide/performance/index.en.rst:185
 msgid ""
-"By default, |TS| creates 1.5 threads per CPU core on the host system. This "
+"By default, |TS| creates one thread per CPU core on the host system. This "
 "may be adjusted with the following settings in :file:`records.config`:"
 msgstr ""
 
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index a3c4d10..4a16063 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -111,7 +111,7 @@ static const RecordElement RecordsConfig[] =
   // By default Traffic Server set number of execution threads equal to total 
CPUs
   {RECT_CONFIG, "proxy.config.exec_thread.autoconfig", RECD_INT, "1", 
RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_READ_ONLY}
   ,
-  {RECT_CONFIG, "proxy.config.exec_thread.autoconfig.scale", RECD_FLOAT, "1", 
RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_READ_ONLY}
+  {RECT_CONFIG, "proxy.config.exec_thread.autoconfig.scale", RECD_FLOAT, 
"1.0", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_READ_ONLY}
   ,
   {RECT_CONFIG, "proxy.config.exec_thread.limit", RECD_INT, "2", 
RECU_RESTART_TS, RR_NULL, RECC_INT, "[1-" TS_STR(TS_MAX_NUMBER_EVENT_THREADS) 
"]", RECA_READ_ONLY}
   ,



[trafficserver] branch 9.0.x updated: Fixed core when sending back a redirect and having an invalid server response (#7004)

2020-07-20 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 413223b  Fixed core when sending back a redirect and having an invalid 
server response (#7004)
413223b is described below

commit 413223b6f454d95386f7fb3bb134542ac9a506a5
Author: Bryan Call 
AuthorDate: Thu Jul 16 11:53:01 2020 -0700

Fixed core when sending back a redirect and having an invalid server 
response (#7004)


(cherry picked from commit 76f32dfda6fa9c403a7368872bad12bc0e1c0c52)
---
 proxy/http/HttpTransact.cc | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b2f8859..cdb4cf6 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -1920,22 +1920,27 @@ HttpTransact::OSDNSLookup(State *s)
   
ink_release_assert(s->http_config_param->redirect_actions_map->contains(s->host_db_info.ip(),
 reinterpret_cast()));
   action = static_cast(x);
 }
-switch (action) {
-case RedirectEnabled::Action::FOLLOW:
+
+if (action == RedirectEnabled::Action::FOLLOW) {
   TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Following");
-  break;
-case RedirectEnabled::Action::REJECT:
-  TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Rejecting.");
+} else if (action == RedirectEnabled::Action::REJECT || 
s->hdr_info.server_response.valid() == false) {
+  if (action == RedirectEnabled::Action::REJECT) {
+TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Rejecting.");
+  } else {
+// Invalid server response, since we can't copy it we are going to 
reject
+TxnDebug("http_trans", "[OSDNSLookup] Invalid server response. 
Rejecting.");
+Error("Invalid server response. Rejecting.");
+  }
   build_error_response(s, HTTP_STATUS_FORBIDDEN, nullptr, 
"request#syntax_error");
   SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_NO_FORWARD);
   TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, nullptr);
-  break;
-case RedirectEnabled::Action::RETURN:
-  TxnDebug("http_trans", "[OSDNSLookup] Configured to return on invalid 
redirect address.");
-  // fall-through
-default:
-  // Return this 3xx to the client as-is.
-  TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Returning.");
+} else {
+  // Return this 3xx to the client as-is
+  if (action == RedirectEnabled::Action::RETURN) {
+TxnDebug("http_trans", "[OSDNSLookup] Configured to return on invalid 
redirect address.");
+  } else {
+TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Returning.");
+  }
   build_response_copy(s, >hdr_info.server_response, 
>hdr_info.client_response, s->client_info.http_version);
   TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, nullptr);
 }



[trafficserver] branch master updated: slice: clean up of created 502 response header (#6919)

2020-07-20 Thread bnolsen
This is an automated email from the ASF dual-hosted git repository.

bnolsen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 9d23ab6  slice: clean up of created 502 response header (#6919)
9d23ab6 is described below

commit 9d23ab6932102cb7741d256791c7c29fe436b138
Author: Brian Olsen 
AuthorDate: Mon Jul 20 08:58:54 2020 -0600

slice: clean up of created 502 response header (#6919)

Change header debug to use TSHttpHdrPrint.

Co-authored-by: Brian Olsen 
---
 plugins/experimental/slice/Data.h|  9 ++--
 plugins/experimental/slice/HttpHeader.cc | 84 +++--
 plugins/experimental/slice/Stage.h   |  9 
 plugins/experimental/slice/client.cc |  8 ---
 plugins/experimental/slice/response.cc   | 12 +++--
 plugins/experimental/slice/response.h|  2 +-
 plugins/experimental/slice/server.cc | 23 ++--
 plugins/experimental/slice/slice.cc  | 92 +++-
 plugins/experimental/slice/slice.h   | 43 +--
 plugins/experimental/slice/util.cc   |  4 +-
 10 files changed, 48 insertions(+), 238 deletions(-)

diff --git a/plugins/experimental/slice/Data.h 
b/plugins/experimental/slice/Data.h
index e29ad84..f8cdd64 100644
--- a/plugins/experimental/slice/Data.h
+++ b/plugins/experimental/slice/Data.h
@@ -48,6 +48,9 @@ struct Data {
 
   sockaddr_storage m_client_ip;
 
+  // transaction pointer
+  TSHttpTxn m_txnp{nullptr};
+
   // for pristine/effective url coming in
   TSMBuffer m_urlbuf{nullptr};
   TSMLoc m_urlloc{nullptr};
@@ -96,16 +99,10 @@ struct Data {
 m_hostname[0] = '\0';
 m_etag[0] = '\0';
 m_lastmodified[0] = '\0';
-#if defined(COLLECT_STATS)
-TSStatIntIncrement(stats::DataCreate, 1);
-#endif
   }
 
   ~Data()
   {
-#if defined(COLLECT_STATS)
-TSStatIntIncrement(stats::DataDestroy, 1);
-#endif
 if (nullptr != m_urlbuf) {
   if (nullptr != m_urlloc) {
 TSHandleMLocRelease(m_urlbuf, TS_NULL_MLOC, m_urlloc);
diff --git a/plugins/experimental/slice/HttpHeader.cc 
b/plugins/experimental/slice/HttpHeader.cc
index ba47b56..d98d112 100644
--- a/plugins/experimental/slice/HttpHeader.cc
+++ b/plugins/experimental/slice/HttpHeader.cc
@@ -290,77 +290,33 @@ HttpHeader::toString() const
 {
   std::string res;
 
-  if (!isValid()) {
-return "";
-  }
-
-  TSHttpType const htype(type());
-
-  switch (htype) {
-  case TS_HTTP_TYPE_REQUEST: {
-res.append(method());
+  if (isValid()) {
+TSIOBuffer const iobufp = TSIOBufferCreate();
+TSHttpHdrPrint(m_buffer, m_lochdr, iobufp);
+TSIOBufferReader const reader = TSIOBufferReaderAlloc(iobufp);
+
+if (nullptr != reader) {
+  TSIOBufferBlock block = TSIOBufferReaderStart(reader);
+  bool done = false;
+  while (!done && nullptr != block) {
+int64_t avail= 0;
+char const *blockptr = TSIOBufferBlockReadStart(block, reader, );
+if (0 < avail) {
+  res.append(blockptr, avail);
+}
+block = TSIOBufferBlockNext(block);
+  }
 
-int urllen = 0;
-char *const urlstr = urlString();
-if (nullptr != urlstr) {
-  res.append(" ");
-  res.append(urlstr, urllen);
-  TSfree(urlstr);
-} else {
-  res.append(" UnknownURL");
+  TSIOBufferReaderFree(reader);
 }
 
-res.append(" HTTP/unparsed");
-  } break;
-
-  case TS_HTTP_TYPE_RESPONSE: {
-char bufstr[1024];
-/*
-int const version = TSHttpHdrVersionGet(m_buffer, m_lochdr);
-snprintf(bufstr, 1023, "%d ", version);
-res.append(bufstr);
-*/
-res.append("HTTP/unparsed");
-
-int const status = TSHttpHdrStatusGet(m_buffer, m_lochdr);
-snprintf(bufstr, 1023, " %d ", status);
-res.append(bufstr);
-
-int reasonlen = 0;
-char const *const hreason = reason();
-
-res.append(hreason, reasonlen);
-  } break;
-
-  default:
-  case TS_HTTP_TYPE_UNKNOWN:
-res.append("UNKNOWN");
-break;
+TSIOBufferDestroy(iobufp);
   }
 
-  res.append("\r\n");
-
-  int const numhdrs = TSMimeHdrFieldsCount(m_buffer, m_lochdr);
-
-  for (int indexhdr = 0; indexhdr < numhdrs; ++indexhdr) {
-TSMLoc const locfield = TSMimeHdrFieldGet(m_buffer, m_lochdr, indexhdr);
-
-int keylen   = 0;
-char const *const keystr = TSMimeHdrFieldNameGet(m_buffer, m_lochdr, 
locfield, );
-
-res.append(keystr, keylen);
-res.append(": ");
-int vallen   = 0;
-char const *const valstr = TSMimeHdrFieldValueStringGet(m_buffer, 
m_lochdr, locfield, -1, );
-
-res.append(valstr, vallen);
-res.append("\r\n");
-
-TSHandleMLocRelease(m_buffer, m_lochdr, locfield);
+  if (res.empty()) {
+res = "";
   }
 
-  res.append("\r\n");
-
   return res;
 }
 
diff --git a/plugins/experimental/slice/Stage.h 
b/plugins/experimental/slice/Stage.h
index