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

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

commit 2779fae61c44c9f296c51eee82da13147d791f36
Author: Jason <dragon...@live.com>
AuthorDate: Thu Mar 2 17:12:17 2017 -0600

    Fix custom log test
    Added 10 second delay to get AST to write out the log file
    Added a verbose message to help clarify a conf file was written as expected
---
 .../gold_tests/autest-site/trafficserver.test.ext  |   2 +
 tests/gold_tests/logging/custom-log.test.py        | 103 +++++++++++++++++++++
 tests/gold_tests/logging/custom.test.py            |  85 -----------------
 3 files changed, 105 insertions(+), 85 deletions(-)

diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext 
b/tests/gold_tests/autest-site/trafficserver.test.ext
index 9fef2d1..f8e2dc8 100644
--- a/tests/gold_tests/autest-site/trafficserver.test.ext
+++ b/tests/gold_tests/autest-site/trafficserver.test.ext
@@ -266,6 +266,7 @@ class Config(File):
         '''
         Write contents to disk
         '''
+        host.WriteVerbosef('ats-config-file',"Writting out file {0}",self.Name)
         if self.content is not None:
             with open(name, 'w') as f:
                 f.write(self.content)
@@ -307,6 +308,7 @@ class RecordsConfig(Config, dict):
         self.WriteCustomOn(self._do_write)
 
     def _do_write(self,name):
+        host.WriteVerbosef('ats-config-file',"Writting out file {0}",name)
         if len(self) > 0:
             with open(name, 'w') as f:
                 for name, val in self.items():
diff --git a/tests/gold_tests/logging/custom-log.test.py 
b/tests/gold_tests/logging/custom-log.test.py
new file mode 100644
index 0000000..f58f146
--- /dev/null
+++ b/tests/gold_tests/logging/custom-log.test.py
@@ -0,0 +1,103 @@
+'''
+'''
+#  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.
+
+import os
+
+Test.Summary = '''
+Test custom log file format
+'''
+# need Curl
+Test.SkipUnless(
+    Condition.HasProgram(
+        "curl", "Curl need to be installed on system for this test to work"),
+    Condition.IsPlatform("linux")
+)
+
+# Define default ATS
+ts = Test.MakeATSProcess("ts")
+
+# setup some config file for this server
+ts.Disk.remap_config.AddLine(
+    'map / http://www.linkedin.com/ @action=deny'
+)
+
+ts.Disk.logging_config.AddLines(
+    '''custom = format {
+  Format = "%<hii> %<hiih>"
+}
+
+log.ascii {
+  Format = custom,
+  Filename = 'test_log_field'
+}'''.split("\n")
+)
+
+# #########################################################################
+# at the end of the different test run a custom log file should exist
+# Because of this we expect the testruns to pass the real test is if the
+# customlog file exists and passes the format check
+Test.Disk.File(os.path.join(ts.Variables.LOGDIR, 'test_log_field.log'),
+               exists=True, content='gold/custom.gold')
+
+# first test is a miss for default
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.0.0.1:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+# time delay as proxy.config.http.wait_for_cache could be broken
+tr.Processes.Default.StartBefore(Test.Processes.ts)
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.1.1.1:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.2.2.2:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.3.3.3:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.3.0.1:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.43.2.1:{0}"; --verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.213.213.132:{0}"; 
--verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl "http://127.123.32.243:{0}"; 
--verbose'.format(
+    ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.DelayStart=10
+tr.Processes.Default.Command = 'echo "Delay"'
+tr.Processes.Default.ReturnCode = 0
\ No newline at end of file
diff --git a/tests/gold_tests/logging/custom.test.py 
b/tests/gold_tests/logging/custom.test.py
deleted file mode 100644
index c558eb3..0000000
--- a/tests/gold_tests/logging/custom.test.py
+++ /dev/null
@@ -1,85 +0,0 @@
-'''
-'''
-#  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.
-
-import os
-
-Test.Summary = '''
-Test custom log file format
-'''
-# need Curl
-Test.SkipUnless(
-    Condition.HasProgram("curl", "Curl need to be installed on system for this 
test to work"),
-    Condition.IsPlatform("linux")
-    )
-
-# Define default ATS
-ts=Test.MakeATSProcess("ts")
-
-# setup some config file for this server
-ts.Disk.remap_config.AddLine(
-            'map / http://www.linkedin.com/ @action=deny'
-        )
-
-ts.Disk.logging_config.AddLines(
-            '''custom = format {
-  Format = "%<hii> %<hiih>"
-}
-
-log.ascii {
-  Format = custom,
-  Filename = 'test_log_field'
-}'''.split("\n")
-        )
-# at the end of the different test run a custom log file should exist
-Test.Disk.File(os.path.join(ts.Variables.LOGDIR,'test_log_field.log'),exists=True,content='gold/custom.gold')
-
-#first test is a miss for default
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.0.0.1:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-# time delay as proxy.config.http.wait_for_cache could be broken
-tr.Processes.Default.StartBefore(Test.Processes.ts)
-        
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.1.1.1:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.2.2.2:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.3.3.3:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.3.0.1:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.43.2.1:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.213.213.132:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
-
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl "http://127.123.32.243:{0}"; 
--verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0    
-

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Reply via email to