You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by dr...@apache.org on 2018/04/05 15:16:09 UTC

[trafficserver] branch master updated: updated test of runroot

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

dragon 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 b294915  updated test of runroot
b294915 is described below

commit b294915e000db45585eb113bbd102cb3509e7b94
Author: Xavier Chi <ch...@gmail.com>
AuthorDate: Fri Mar 30 14:50:21 2018 -0500

    updated test of runroot
---
 .../runroot_init.test.py}                          | 36 +++++-----
 tests/gold_tests/runroot/runroot_remove.test.py    | 76 ++++++++++++++++++++++
 tests/gold_tests/runroot/runroot_use.test.py       | 67 +++++++++++++++++++
 3 files changed, 164 insertions(+), 15 deletions(-)

diff --git a/tests/gold_tests/basic/runroot.test.py b/tests/gold_tests/runroot/runroot_init.test.py
similarity index 54%
rename from tests/gold_tests/basic/runroot.test.py
rename to tests/gold_tests/runroot/runroot_init.test.py
index c6ca36c..a3b8be1 100644
--- a/tests/gold_tests/basic/runroot.test.py
+++ b/tests/gold_tests/runroot/runroot_init.test.py
@@ -21,27 +21,33 @@ import sys
 import time
 
 Test.Summary = '''
-Test that use for runroot from traffic_layout is all functional.
+Test for init of runroot from traffic_layout.
 '''
 Test.ContinueOnFail = True
 
 p = Test.MakeATSProcess("ts")
-path = os.path.join(p.Env['TS_ROOT'], "runroot")
+ts_root = p.Env['TS_ROOT']
 
-# normal init from pass in path
-tr = Test.AddTestRun("Test traffic_layout init")
-tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path
+# init from pass in path
+path1 = os.path.join(ts_root, "runroot1")
+tr = Test.AddTestRun("Test traffic_layout init #1")
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path1
 tr.Processes.Default.ReturnCode = 0
-d = tr.Disk.Directory(path)
-d.Exists = True
-f = tr.Disk.File(os.path.join(path, "runroot_path.yml"))
+f = tr.Disk.File(os.path.join(path1, "runroot_path.yml"))
 f.Exists = True
 
-# remove from pass in path
-tr = Test.AddTestRun("Test traffic_layout remove")
-tr.Processes.Default.Command = "$ATS_BIN/traffic_layout remove --path " + path
+# init to relative directory
+path2 = os.path.join(ts_root, "runroot2")
+tr = Test.AddTestRun("Test traffic_layout init #2")
+tr.Processes.Default.Command = "cd " + ts_root + "; " + "$ATS_BIN/traffic_layout init --path runroot2"
 tr.Processes.Default.ReturnCode = 0
-d = tr.Disk.Directory(path)
-d.Exists = False
-f = tr.Disk.File(os.path.join(path, "runroot_path.yml"))
-f.Exists = False
+f = tr.Disk.File(os.path.join(path2, "runroot_path.yml"))
+f.Exists = True
+
+# init to cwd
+path3 = os.path.join(ts_root, "runroot3")
+tr = Test.AddTestRun("Test traffic_layout init #3")
+tr.Processes.Default.Command = "mkdir " + path3 + "; cd " + path3 + "; " + "$ATS_BIN/traffic_layout init"
+tr.Processes.Default.ReturnCode = 0
+f = tr.Disk.File(os.path.join(path3, "runroot_path.yml"))
+f.Exists = True
diff --git a/tests/gold_tests/runroot/runroot_remove.test.py b/tests/gold_tests/runroot/runroot_remove.test.py
new file mode 100644
index 0000000..244b100
--- /dev/null
+++ b/tests/gold_tests/runroot/runroot_remove.test.py
@@ -0,0 +1,76 @@
+'''
+'''
+#  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
+import sys
+import time
+
+Test.Summary = '''
+Test for remove of runroot from traffic_layout.
+'''
+Test.ContinueOnFail = True
+
+p = Test.MakeATSProcess("ts")
+ts_root = p.Env['TS_ROOT']
+
+
+# create three runroot for removing testing
+path1 = os.path.join(ts_root, "runroot1")
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path1
+f = tr.Disk.File(os.path.join(path1, "runroot_path.yml"))
+f.Exists = True
+
+path2 = os.path.join(ts_root, "runroot2")
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path2
+f = tr.Disk.File(os.path.join(path2, "runroot_path.yml"))
+f.Exists = True
+
+path3 = os.path.join(ts_root, "runroot3")
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path3
+f = tr.Disk.File(os.path.join(path3, "runroot_path.yml"))
+f.Exists = True
+
+# normal remove from pass in path
+tr = Test.AddTestRun("Test traffic_layout remove #1")
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout remove --path " + path1
+tr.Processes.Default.ReturnCode = 0
+f = tr.Disk.File(os.path.join(path1, "runroot_path.yml"))
+f.Exists = False
+d = tr.Disk.Directory(path1)
+d.Exists = False
+
+# remove of relative path
+tr = Test.AddTestRun("Test traffic_layout remove #2")
+tr.Processes.Default.Command = "cd " + ts_root + "; " + "$ATS_BIN/traffic_layout remove --path runroot2"
+tr.Processes.Default.ReturnCode = 0
+f = tr.Disk.File(os.path.join(path2, "runroot_path.yml"))
+f.Exists = False
+d = tr.Disk.Directory(path2)
+d.Exists = False
+
+# remove cwd
+tr = Test.AddTestRun("Test traffic_layout remove #3")
+tr.Processes.Default.Command = "mkdir " + path3 + "; cd " + path3 + "; " + "$ATS_BIN/traffic_layout remove"
+tr.Processes.Default.ReturnCode = 0
+f = tr.Disk.File(os.path.join(path3, "runroot_path.yml"))
+f.Exists = False
+d = tr.Disk.Directory(path2)
+d.Exists = False
diff --git a/tests/gold_tests/runroot/runroot_use.test.py b/tests/gold_tests/runroot/runroot_use.test.py
new file mode 100644
index 0000000..25758c5
--- /dev/null
+++ b/tests/gold_tests/runroot/runroot_use.test.py
@@ -0,0 +1,67 @@
+'''
+'''
+#  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
+import sys
+import time
+
+Test.Summary = '''
+Test for using of runroot from traffic_layout.
+'''
+Test.ContinueOnFail = True
+
+p = Test.MakeATSProcess("ts")
+ts_root = p.Env['TS_ROOT']
+
+# create two runroot for testing
+path = os.path.join(ts_root, "runroot")
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path
+f = tr.Disk.File(os.path.join(path, "runroot_path.yml"))
+f.Exists = True
+
+path2 = os.path.join(ts_root, "runroot2")
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "$ATS_BIN/traffic_layout init --path " + path2
+f = tr.Disk.File(os.path.join(path2, "runroot_path.yml"))
+f.Exists = True
+
+# 1. --run-root use path cmd
+tr = Test.AddTestRun("use runroot via commandline")
+tr.Processes.Default.Command = os.path.join("$ATS_BIN/traffic_layout info --run-root=" + path)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.All = Testers.ContainsExpression("PREFIX: " + path, "commandline runroot path")
+
+# 2. use cwd as runroot
+tr = Test.AddTestRun("use runroot via cwd")
+tr.Processes.Default.Command = "cd " + path + ";" + os.path.join("$ATS_BIN/traffic_layout info")
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.All = Testers.ContainsExpression("PREFIX: " + path, "cwd runroot path")
+
+# 4. use path directly bin
+tr = Test.AddTestRun("use runroot via bin executable")
+tr.Processes.Default.Command = os.path.join(path, "bin/traffic_layout info")
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.All = Testers.ContainsExpression("PREFIX: " + path, "bin path")
+
+# 3. TS_RUNROOT ENV variable
+tr = Test.AddTestRun("use runroot via TS_RUNROOT")
+tr.Processes.Default.Env["TS_RUNROOT"] = path2
+tr.Processes.Default.Command = os.path.join("$ATS_BIN/traffic_layout info")
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.All = Testers.ContainsExpression("PREFIX: " + path2, "$TS_RUNROOT Env path")

-- 
To stop receiving notification emails like this one, please contact
dragon@apache.org.