You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/01/29 20:34:30 UTC

[2/2] trafficserver git commit: Re-enable traffic_cop tests

Re-enable traffic_cop tests

- traffic_line tests
- check for all log files (manager.log, traffic.out)

This closes #166.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f4099f3b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f4099f3b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f4099f3b

Branch: refs/heads/master
Commit: f4099f3b3bf445851219882413cc45830263efcb
Parents: c29a81a
Author: Thomas Jackson <ja...@gmail.com>
Authored: Wed Jan 28 20:29:18 2015 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Jan 29 11:34:03 2015 -0800

----------------------------------------------------------------------
 ci/new_tsqa/tests/test_example.py | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f4099f3b/ci/new_tsqa/tests/test_example.py
----------------------------------------------------------------------
diff --git a/ci/new_tsqa/tests/test_example.py b/ci/new_tsqa/tests/test_example.py
index 9593ac4..0a7f468 100644
--- a/ci/new_tsqa/tests/test_example.py
+++ b/ci/new_tsqa/tests/test_example.py
@@ -21,6 +21,7 @@ Some example tests of the new tsqa
 import os
 import requests
 import time
+import subprocess
 
 import helpers
 
@@ -86,7 +87,6 @@ class TestNoOp(helpers.EnvironmentCase):
 class TestConfigureFlags(helpers.EnvironmentCase):
     environment_factory = {
         'configure': {'enable-spdy': None},
-        'env': None,
     }
 
     def test_spdy(self):
@@ -100,19 +100,26 @@ class TestBootstrap(helpers.EnvironmentCase):
         self.assertEqual(ret.status_code, 404)
         self.assertIn('ATS', ret.headers['server'])
 
-    # TODO: re-enable once traffic_manager works
-    @helpers.unittest.skip('TSQA is currently unable to run traffic_cop or traffic_manager')
     def test_trafficline(self):
+        '''
+        Test that traffic_line works, and verify that the values for proxy.config
+        match what we put in records.config
+        '''
         cmd = [os.path.join(self.environment.layout.bindir, 'traffic_line'),
                '-m',
                'proxy.config',
                ]
-        stdout, stderr = tsqa.utils.run_sync_command(cmd)
-        raise Exception(stdout)
+        stdout, _ = tsqa.utils.run_sync_command(cmd, stdout=subprocess.PIPE)
+        for line in stdout.splitlines():
+            if not line.strip():
+                continue
+            k, v = line.split(' ', 1)
+            if k not in self.configs['records.config']['CONFIG']:
+                continue
+            r_val = self.configs['records.config']['CONFIG'][k]
+            self.assertEqual(type(r_val)(v), self.configs['records.config']['CONFIG'][k])
 
 
-# TODO: enable once traffic_cop works (jpeach's fix for proxy.config.admin.user_id)
-'''
 class TestServerIntercept(helpers.EnvironmentCase, tsqa.test_cases.DynamicHTTPEndpointCase):
     endpoint_port = 60000
     @classmethod
@@ -131,8 +138,6 @@ class TestServerIntercept(helpers.EnvironmentCase, tsqa.test_cases.DynamicHTTPEn
             ret = requests.get('http://127.0.0.1:{0}/'.format(self.configs['records.config']['CONFIG']['proxy.config.http.server_ports']))
 
             self.assertEqual(ret.status_code, 200)
-            self.assertIn('ATS', ret.headers['server'])
-'''
 
 
 class TestLogs(helpers.EnvironmentCase):
@@ -161,8 +166,7 @@ class TestLogs(helpers.EnvironmentCase):
         time.sleep(10)  # wait for logs to hit disk
 
         # verify that the log files exist
-        # TODO: check for logs 'manager.log', 'traffic.out
-        for logfile in ('diags.log', 'error.log', 'squid.blog'):
+        for logfile in ('diags.log', 'error.log', 'squid.blog', 'traffic.out', 'manager.log'):
             logfile_path = os.path.join(self.environment.layout.logdir, logfile)
             self.assertTrue(os.path.isfile(logfile_path), logfile_path)