def expected_records_fixture(inputs, base_path) -> List[AirbyteMessage]: path = getattr(inputs, "expected_records_path") if not path: return [] with open(str(base_path / path)) as f: return [AirbyteMessage.parse_raw(line) for line in f]
def run(self, cmd, config=None, state=None, catalog=None, **kwargs) -> Iterable[AirbyteMessage]: self._runs += 1 volumes = self._prepare_volumes(config, state, catalog) logs = self._client.containers.run(image=self._image, command=cmd, working_dir="/data", volumes=volumes, network="host", stdout=True, stderr=True, **kwargs) logging.info("Docker run: \n%s\ninput: %s\noutput: %s", cmd, self.input_folder, self.output_folder) with open(str(self.output_folder / "raw"), "wb+") as f: f.write(logs) for line in logs.decode("utf-8").splitlines(): try: yield AirbyteMessage.parse_raw(line) except ValidationError as exc: logging.warning("Unable to parse connector's output %s", exc)