Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/esi/combo_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ ContentTypeHandler::loadAllowList(std::string const &file_spec)
bool extra_junk_on_line{false};
int line_num = 0;

fs.open(file_spec);
fs.open(file_spec, std::ios_base::in);
if (fs.good()) {
for (;;) {
++line_num;
Expand Down
28 changes: 13 additions & 15 deletions tests/gold_tests/autest-site/trafficserver.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
p.Setup.Copy(p.Variables.BINDIR, bin_path, CopyLogic.SoftFiles)

# setup config directory
AddMethodToInstance(p, chownForATSProcess)

# copy all basic config files we need to get this to work
cfg_dir = os.path.join(AUTEST_SITE_PATH, "min_cfg")

p.Setup.MakeDir(config_dir)
p.Setup.Chown(config_dir, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged group
p.Setup.Chown(config_dir, "nobody", "nogroup", ignore=True)
p.chownForATSProcess(config_dir)

for f in os.listdir(cfg_dir):
p.Setup.CopyAs(os.path.join(cfg_dir, f), config_dir)
Expand Down Expand Up @@ -126,9 +125,7 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
# create subdirectories that need to exist (but are empty)
# log directory has to be created with correct permissions
p.Setup.MakeDir(log_dir) # log directory has to be created
p.Setup.Chown(log_dir, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged group
p.Setup.Chown(log_dir, "nobody", "nogroup", ignore=True)
p.chownForATSProcess(log_dir)

# set env so traffic server uses correct locations
p.Env['PROXY_CONFIG_LOG_LOGFILE_DIR'] = log_dir
Expand All @@ -143,9 +140,7 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
p.Variables.LOCALSTATEDIR = runtime_dir

p.Setup.MakeDir(runtime_dir)
p.Setup.Chown(runtime_dir, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged group
p.Setup.Chown(runtime_dir, "nobody", "nogroup", ignore=True)
p.chownForATSProcess(runtime_dir)

# will need this for traffic_manager is it runs
p.Setup.MakeDir(os.path.join(config_dir, 'snapshots'))
Expand All @@ -154,9 +149,7 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
# create subdirectories that need to exist (but are empty)
# ssl directory has to be created for keeping certs and keys
p.Setup.MakeDir(ssl_dir)
p.Setup.Chown(ssl_dir, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged server
p.Setup.Chown(ssl_dir, "nobody", "nogroup", ignore=True)
p.chownForATSProcess(ssl_dir)

# set env so traffic server uses correct locations
p.Env['PROXY_CONFIG_SSL_DIR'] = ssl_dir
Expand All @@ -169,9 +162,7 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
########################################################
# cache.db directory
p.Setup.MakeDir(storage_dir)
p.Setup.Chown(storage_dir, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged group
p.Setup.Chown(storage_dir, "nobody", "nogroup", ignore=True)
p.chownForATSProcess(storage_dir)

# set env so traffic server uses correct locations
p.Env['PROXY_CONFIG_STORAGE_DIR'] = storage_dir
Expand Down Expand Up @@ -461,6 +452,12 @@ class RecordsConfig(Config, dict):
##########################################################################


def chownForATSProcess(self, path):
self.Setup.Chown(path, "nobody", "nobody", ignore=True)
# covers ubuntu's unprivileged group
self.Setup.Chown(path, "nobody", "nogroup", ignore=True)


def addSSLfile(self, filename):
self.Setup.CopyAs(filename, self.Variables.SSLDir)

Expand All @@ -476,4 +473,5 @@ def addSSLFileFromDefaultTestFolder(self, filename):

RegisterFileType(Config, "ats:config")
RegisterFileType(RecordsConfig, "ats:config:records")
ExtendTestRun(chownForATSProcess, name="ChownForATSProcess")
ExtendTest(MakeATSProcess, name="MakeATSProcess")
10 changes: 4 additions & 6 deletions tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

Test.Summary = '''
Test combo_handler plugin
'''
Expand Down Expand Up @@ -104,12 +106,8 @@ def add_server_obj(content_type, path):
'map http://localhost/sub/ http://127.0.0.1:{}/sub/'.format(server.Variables.Port)
)

ts.Disk.File(ts.Variables.CONFIGDIR + "/ctwl.txt", id="ctwl_cfg", typename="ats:config")
ts.Disk.ctwl_cfg.AddLine("# test ")
ts.Disk.ctwl_cfg.AddLine("")
ts.Disk.ctwl_cfg.AddLine(" text/javascript # test side comment")
ts.Disk.ctwl_cfg.AddLine(" application/javascript")
ts.Disk.ctwl_cfg.AddLine("text/css")
# Configure the combo_handler's configuration file.
ts.Setup.Copy("ctwl.txt", ts.Variables.CONFIGDIR)

tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(ts)
Expand Down
5 changes: 5 additions & 0 deletions tests/gold_tests/pluginTest/combo_handler/ctwl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test

text/javascript # test side comment
application/javascript
text/css
7 changes: 6 additions & 1 deletion tests/gold_tests/pluginTest/lua/lua_watermark.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

Test.Summary = '''
Test lua functionality
'''
Expand All @@ -41,9 +43,12 @@

ts.Disk.remap_config.AddLine(
'map / http://127.0.0.1:{}/'.format(server.Variables.Port) +
' @plugin=tslua.so @pparam={}/watermark.lua'.format(Test.TestDirectory)
' @plugin=tslua.so @pparam=watermark.lua'
)

# Configure the tslua's configuration file.
ts.Setup.Copy("watermark.lua", ts.Variables.CONFIGDIR)

ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'ts_lua'
Expand Down
9 changes: 5 additions & 4 deletions tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
)
Test.ContinueOnFail = True

# test_hooks.so will output test logging to this file.
Test.Env["OUTPUT_FILE"] = Test.RunDirectory + "/log.txt"

server = Test.MakeOriginServer("server")

request_header = {
Expand All @@ -40,6 +37,10 @@
# server.
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True, enable_cache=False)

# test_hooks.so will output test logging to this file.
log_path = os.path.join(ts.Variables.LOGDIR, "log.txt")
Test.Env["OUTPUT_FILE"] = log_path

ts.addDefaultSSLFiles()

ts.Disk.records_config.update({
Expand Down Expand Up @@ -96,6 +97,6 @@
tr = Test.AddTestRun()
tr.Processes.Default.Command = "echo check log"
tr.Processes.Default.ReturnCode = 0
f = tr.Disk.File("log.txt")
f = tr.Disk.File(log_path)
f.Content = "log.gold"
f.Content += Testers.ContainsExpression("Global: event=TS_EVENT_VCONN_CLOSE", "VCONN_CLOSE should trigger 2 times")
14 changes: 8 additions & 6 deletions tests/gold_tests/pluginTest/tsapi/tsapi.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
)
Test.ContinueOnFail = True

# test_tsapi.so will output test logging to this file.
Test.Env["OUTPUT_FILE"] = Test.RunDirectory + "/log.txt"

server = Test.MakeOriginServer("server")

request_header = {
Expand All @@ -45,6 +42,10 @@
# server.
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True, enable_cache=False)

# test_tsapi.so will output test logging to this file.
log_path = os.path.join(ts.Variables.LOGDIR, "log.txt")
Test.Env["OUTPUT_FILE"] = log_path

ts.addDefaultSSLFiles()

ts.Disk.records_config.update({
Expand All @@ -61,12 +62,13 @@
)

rp = os.path.join(Test.TestDirectory, '.libs', 'test_tsapi.so')
ts.Setup.Copy(rp, ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR'])

ts.Disk.remap_config.AddLine(
"map http://myhost.test http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, rp)
"map http://myhost.test http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, "test_tsapi.so")
)
ts.Disk.remap_config.AddLine(
"map https://myhost.test:123 http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, rp)
"map https://myhost.test:123 http://127.0.0.1:{0} @plugin={1} @plugin={1}".format(server.Variables.Port, "test_tsapi.so")
)

tr = Test.AddTestRun()
Expand Down Expand Up @@ -94,7 +96,7 @@

tr = Test.AddTestRun()
# Change server port number (which can vary) to a fixed string for compare to gold file.
tr.Processes.Default.Command = "sed 's/{}/SERVER_PORT/' < log.txt > log2.txt".format(server.Variables.Port)
tr.Processes.Default.Command = "sed 's/{}/SERVER_PORT/' < {} > log2.txt".format(server.Variables.Port, log_path)
tr.Processes.Default.ReturnCode = 0
f = tr.Disk.File("log2.txt")
f.Content = "log.gold"
Loading