def test_receive_and_unpack_on_worker(self): obj = Unpacker() obj.engine = EngineEmul() obj.engine.config.merge({ "execution": { "executor": "selenium", "concurrency": 5500, "scenario": { "script": "java_package.zip"}}, "modules": { "selenium": "bzt.modules.selenium.SeleniumExecutor", "cloud": "bzt.modules.blazemeter.CloudProvisioning"}, "provisioning": "local" }) obj.engine.file_search_paths = [obj.engine.artifacts_dir] obj.parameters["files"] = ["java_package.zip"] # create archive and put it in artifact dir source = __dir__() + "/../selenium/java_package" zip_name = obj.engine.create_artifact('java_package', '.zip') with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_STORED) as zip_file: for filename in get_files_recursive(source): zip_file.write(filename, filename[len(os.path.dirname(source)):]) obj.prepare() # check unpacked tree destination = obj.engine.artifacts_dir + '/java_package' result_tree = set(filename[len(destination):] for filename in get_files_recursive(destination)) original_tree = set(filename[len(source):] for filename in get_files_recursive(source)) self.assertEqual(result_tree, original_tree)
def test_no_work_prov(self): obj = Unpacker() obj.engine = EngineEmul() obj.engine.config[Provisioning.PROV] = 'cloud' obj.parameters.merge({Unpacker.FILES: ['notexists.zip']}) obj.prepare()