def test_default_returns_params(self): thrift_result = module.migrate_params_thrift( RawParams({ "A": [1], "B": "x" }).to_thrift()) result = RawParams.from_thrift(thrift_result).params self.assertEqual(result, {"A": [1], "B": "x"})
def migrate_params(self, compiled_module: CompiledModule, params: Dict[str, Any]) -> None: request = RawParams(params).to_thrift() with _chroot_dir_context() as chroot: response = self._run_in_child( chroot=chroot, chroot_paths=DATA_PATHS, compiled_module=compiled_module, timeout=self.migrate_params_timeout, result=ttypes.RawParams(), function="migrate_params_thrift", args=[request], ) return RawParams.from_thrift(response).params
def migrate_params( self, compiled_module: CompiledModule, params: Dict[str, Any] ) -> None: """ Call a module's migrate_params(). """ request = RawParams(params).to_thrift() response = self._run_in_child( chroot_dir=READONLY_CHROOT_DIR, network_config=None, compiled_module=compiled_module, timeout=self.migrate_params_timeout, result=ttypes.RawParams(), function="migrate_params_thrift", args=[request], ) return RawParams.from_thrift(response).params
def _test(self, fn, params={}): with patch.object(module, "migrate_params", fn): thrift_result = module.migrate_params_thrift(RawParams(params).to_thrift()) return RawParams.from_thrift(thrift_result).params