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

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 512449e3000466a744dd9a2aba35b5f819ea1bf4
Author: Chuck Rolke <[email protected]>
AuthorDate: Fri Mar 29 15:26:32 2019 -0400

    DISPATCH-1307: Add a self test for scraper tool
    
    The scraper test is heaped onto the topology_disposition self test mainly
    because that self test generates a very rich set of log files.
    
    * Cmake is modified to copy the scraper source files into the build tree.
    * Scraper is run twice: once to aggreagte the log files, and once to
      split a single log file.
---
 CMakeLists.txt                             |  2 ++
 tests/system_tests_topology_disposition.py | 42 ++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1a30f6..72a6047 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -214,6 +214,8 @@ 
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py
 execute_process(COMMAND ${RUN} --sh OUTPUT_FILE config.sh)
 
 if (NOT UNITTEST2_MISSING)
+  file(GLOB SCRAPER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/tools/scraper/*.py)
+  file(COPY ${SCRAPER_SRC} DESTINATION 
${CMAKE_CURRENT_BINARY_DIR}/tests/scraper/)
   add_subdirectory(tests)
 endif(NOT UNITTEST2_MISSING)
 add_subdirectory(python)
diff --git a/tests/system_tests_topology_disposition.py 
b/tests/system_tests_topology_disposition.py
index a701c6d..9cec6d0 100644
--- a/tests/system_tests_topology_disposition.py
+++ b/tests/system_tests_topology_disposition.py
@@ -108,7 +108,6 @@ class ManagementMessageHelper ( object ) :
         return Message ( body=msg_body, properties=props, 
reply_to=self.reply_addr )
 
 
-
 #================================================
 # END Helper classes for all tests.
 #================================================
@@ -371,7 +370,8 @@ class TopologyDispositionTests ( TestCase ):
         # 1 means skip that test.
         cls.skip = { 'test_01' : 0,
                      'test_02' : 0,
-                     'test_03' : 0
+                     'test_03' : 0,
+                     'test_04' : 0
                    }
 
 
@@ -435,6 +435,44 @@ class TopologyDispositionTests ( TestCase ):
             self.assertEqual ( None, error )
 
 
+    def test_04_scraper_tool ( self ):
+        name = 'test_04'
+        error = None
+        if self.skip [ name ] :
+            self.skipTest ( "Test skipped during development." )
+
+        scraper_path = os.path.join(os.environ.get('BUILD_DIR'), 'tests', 
'scraper', 'scraper.py')
+
+        # aggregate all the log files
+        files = []
+        for letter in ['A', 'B', 'C', 'D']:
+            files.append('../setUpClass/%s.log' % letter)
+        p = self.popen(['/usr/bin/env', 'python', scraper_path, '-f'] + files,
+                       stdin=PIPE, stdout=PIPE, stderr=STDOUT,
+                       universal_newlines=True)
+        out = p.communicate(None)[0]
+        try:
+            p.teardown()
+        except Exception as e:
+            error = str(e)
+
+        self.assertEqual ( None, error )
+        self.assertTrue( '</body>' in out )
+
+        # split A.log
+        p = self.popen(['/usr/bin/env', 'python', scraper_path, '--split', 
'-f', '../setUpClass/A.log'],
+                       stdin=PIPE, stdout=PIPE, stderr=STDOUT,
+                       universal_newlines=True)
+        out = p.communicate(None)[0]
+        try:
+            p.teardown()
+        except Exception as e:
+            error = str(e)
+
+        self.assertEqual ( None, error )
+        self.assertTrue( '</body>' in out )
+
+
 #################################################################
 #     Tests
 #################################################################


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to