소스 검색

AMBARI-14821: Unit tests doesn't export scripts from common-services folder into PYTHONPATH (nalex via jaoki)

Jun Aoki 9 년 전
부모
커밋
d032056754
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      ambari-server/src/test/python/unitTests.py

+ 8 - 0
ambari-server/src/test/python/unitTests.py

@@ -108,6 +108,14 @@ def stack_test_executor(base_folder, service, stack, custom_tests, executor_resu
     if os.path.split(root)[-1] in ["scripts", "files"] and service in root:
       script_folders.add(root)
 
+  # Add the common-services scripts directories to the PATH
+  base_commserv_folder = os.path.join(server_src_dir, "main", "resources", "common-services")
+  for folder, subFolders, files in os.walk(os.path.join(base_commserv_folder, service)):
+    # folder will return the versions of the services
+    scripts_dir = os.path.join(folder, "package", "scripts")
+    if os.path.exists(scripts_dir):
+      script_folders.add(scripts_dir)
+
   sys.path.extend(script_folders)
 
   tests = get_test_files(base_folder, mask = test_mask)