From 0ddee8956896e08a06f334fdb9dd25aea3b4f9bf Mon Sep 17 00:00:00 2001 From: Jarkko Jaakola Date: Wed, 24 Jul 2024 12:30:04 +0300 Subject: [PATCH] test exc --- .github/workflows/tests.yml | 4 ---- karapace/protobuf/io.py | 14 +++++++------- tests/unit/test_protobuf_serialization.py | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fd9a63c2b..74af19e6e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,10 +40,6 @@ jobs: env: COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" PYTEST_ARGS: "--cov=karapace --cov-append" - - run: make integration-tests - env: - COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" - PYTEST_ARGS: "--cov=karapace --cov-append --random-order" - name: Archive logs uses: actions/upload-artifact@v4 diff --git a/karapace/protobuf/io.py b/karapace/protobuf/io.py index 3cc7445dc..6f4896a0b 100644 --- a/karapace/protobuf/io.py +++ b/karapace/protobuf/io.py @@ -256,13 +256,13 @@ def writer_process( # Writing happens in the forked process, catch is broad so exception will get communicated # back to calling process. except Exception as bare_exception: # pylint: disable=broad-exception-caught - try: - raise ProtobufTypeException(writer_schema, datum) from bare_exception - except ProtobufTypeException as protobuf_exception: - writer_queue.put(protobuf_exception) - raise protobuf_exception - except BaseException as base_exception: # pylint: disable=broad-exception-caught - writer_queue.put(base_exception) + #try: + # raise ProtobufTypeException(writer_schema, datum) from bare_exception + #except ProtobufTypeException as protobuf_exception: + # writer_queue.put(protobuf_exception) + # raise protobuf_exception + writer_queue.put(bare_exception) + raise bare_exception writer_queue.put(class_instance.SerializeToString()) diff --git a/tests/unit/test_protobuf_serialization.py b/tests/unit/test_protobuf_serialization.py index ee2586d63..5cf60c7ce 100644 --- a/tests/unit/test_protobuf_serialization.py +++ b/tests/unit/test_protobuf_serialization.py @@ -226,14 +226,14 @@ async def test_serialization_fails(default_config_path: Path): mock_protobuf_registry_client.get_schema.return_value = get_latest_schema_future serializer = await make_ser_deser(default_config_path, mock_protobuf_registry_client) - with pytest.raises(InvalidMessageSchema): + with pytest.raises(RuntimeError): schema = await serializer.get_schema_for_subject("top") await serializer.serialize(schema, test_fail_objects_protobuf[0]) assert mock_protobuf_registry_client.method_calls == [call.get_schema("top")] mock_protobuf_registry_client.reset_mock() - with pytest.raises(InvalidMessageSchema): + with pytest.raises(KeyError): schema = await serializer.get_schema_for_subject("top") await serializer.serialize(schema, test_fail_objects_protobuf[1])