Ejemplo n.º 1
0
    def _check_test_config(self, suite_config, test_case_path):
        '''Woodpecker will firstly check if user passes 
        '-c TEST_CONFIG_FILE_PATH'. If not, it will check if suite.xml defines
        'config=TEST_CONFIG_FILE_PATH'. If not, it will check if config file 
        ~/.zstackwoodpecker/integrationtest/xxx/yyy/test-config.xml existence
        (xxx/yyy should be as same as the test target folder name, e.g. 
        'vm/basic'.) At last woodpecker will use source code test-config.xml in
        current test suite folder. '''
        if self.test_config_file:
            return self.test_config_file
        elif suite_config:
            return suite_config
        else:
            if not 'integrationtest/' in test_case_path:
                return

            test_sub_folder = os.path.dirname(
                test_case_path.split('integrationtest/')[1])
            local_test_config = os.path.join(LOCAL_WOODPECKER_FOLDER,
                                             test_sub_folder, TEST_CONFIG_FILE)
            local_test_config = linux.find_file(TEST_CONFIG_FILE,
                                                local_test_config, 4)
            if local_test_config and os.path.exists(local_test_config):
                return local_test_config
            else:
                source_test_config = linux.find_file(TEST_CONFIG_FILE,
                                                     test_case_path, 4)
                return source_test_config
Ejemplo n.º 2
0
    def _check_test_config(self, suite_config, test_case_path):
        '''Woodpecker will firstly check if user passes 
        '-c TEST_CONFIG_FILE_PATH'. If not, it will check if suite.xml defines
        'config=TEST_CONFIG_FILE_PATH'. If not, it will check if config file 
        ~/.zstackwoodpecker/integrationtest/xxx/yyy/test-config.xml existence
        (xxx/yyy should be as same as the test target folder name, e.g. 
        'vm/basic'.) At last woodpecker will use source code test-config.xml in
        current test suite folder. '''
        if self.test_config_file:
            return self.test_config_file
        elif suite_config:
            return suite_config
        else:
            if not 'integrationtest/' in test_case_path:
                return

            test_sub_folder = os.path.dirname(test_case_path.split('integrationtest/')[1])
            local_test_config = os.path.join(LOCAL_WOODPECKER_FOLDER, test_sub_folder, TEST_CONFIG_FILE)
            local_test_config = linux.find_file(TEST_CONFIG_FILE, local_test_config, 4)
            if local_test_config and os.path.exists(local_test_config):
                return local_test_config
            else:
                source_test_config = linux.find_file(TEST_CONFIG_FILE, test_case_path, 4)
                return source_test_config