Skip to content

[Bug] The test testSchemaIncompatibility is failed in some certain version protobuf #193

@RobertIndie

Description

@RobertIndie

Search before asking

  • I searched in the issues and found nothing similar.

Version

3.1 and master branch

Minimal reproduce step

  • Use macos x86_64
  • Install protobuf 21.12
  • Run test ./pulsar-tests --gtest_filter="ProtobufNativeSchemaTest.testSchemaIncompatibility"

What did you expect to see?

The test passed

What did you see instead?

The test failed:

➜  tests ./pulsar-tests --gtest_filter="ProtobufNativeSchemaTest.testSchemaIncompatibility"
Note: Google Test filter = ProtobufNativeSchemaTest.testSchemaIncompatibility
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ProtobufNativeSchemaTest
[ RUN      ] ProtobufNativeSchemaTest.testSchemaIncompatibility
2023-02-14 15:23:04.272 INFO  [0x10d003600] ClientConnection:190 | [<none> -> pulsar://localhost:6650] Create ClientConnection, timeout=10000
2023-02-14 15:23:04.273 INFO  [0x10d003600] ConnectionPool:97 | Created connection for pulsar://localhost:6650
2023-02-14 15:23:04.275 WARN  [0x700009e8a000] ClientConnection:456 | [<none> -> pulsar://localhost:6650] Failed to establish connection: Connection refused
2023-02-14 15:23:04.275 INFO  [0x700009e8a000] ClientConnection:388 | [127.0.0.1:64503 -> 127.0.0.1:6650] Connected to broker
2023-02-14 15:23:04.314 INFO  [0x700009e8a000] HandlerBase:72 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, ] Getting connection from pool
2023-02-14 15:23:04.356 INFO  [0x700009e8a000] ProducerImpl:202 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, ] Created producer on broker [127.0.0.1:64503 -> 127.0.0.1:6650]
2023-02-14 15:23:04.356 INFO  [0x10d003600] ProducerImpl:740 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, standalone-120-9] Closing producer for topic persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility
2023-02-14 15:23:04.356 INFO  [0x700009e8a000] ProducerImpl:704 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, standalone-120-9] Closed producer 0
2023-02-14 15:23:04.357 INFO  [0x700009e8a000] HandlerBase:72 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, ] Getting connection from pool
2023-02-14 15:23:04.366 INFO  [0x700009e8a000] ProducerImpl:202 | [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, ] Created producer on broker [127.0.0.1:64503 -> 127.0.0.1:6650]
2023-02-14 15:23:04.366 INFO  [0x10d003600] ProducerImpl:695 | Producer - [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, standalone-120-9] , [batchMessageContainer = { BatchMessageContainer [size = 0] [bytes = 0] [maxSize = 1000] [maxBytes = 131072] [topicName = persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility] [numberOfBatchesSent_ = 1] [averageBatchSize_ = 0] }]
/Users/aaronrobert/codebase/cpp-verify/apache-pulsar-client-cpp-3.1.2/tests/ProtobufNativeSchemaTest.cc:109: Failure
Expected equality of these values:
  ResultIncompatibleSchema
    Which is: IncompatibleSchema
  createProducerResult(getExternalMessageDescriptor())
    Which is: Ok
2023-02-14 15:23:04.366 INFO  [0x10d003600] ProducerImpl:695 | Producer - [persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility, standalone-120-10] , [batchMessageContainer = { BatchMessageContainer [size = 0] [bytes = 0] [maxSize = 1000] [maxBytes = 131072] [topicName = persistent://public/default/ProtobufNativeSchemaTest-testSchemaIncompatibility] [numberOfBatchesSent_ = 0] [averageBatchSize_ = 0] }]
2023-02-14 15:23:04.366 INFO  [0x10d003600] ClientConnection:1600 | [127.0.0.1:64503 -> 127.0.0.1:6650] Connection closed with ConnectError
2023-02-14 15:23:04.366 INFO  [0x10d003600] ClientConnection:269 | [127.0.0.1:64503 -> 127.0.0.1:6650] Destroyed connection
[  FAILED  ] ProtobufNativeSchemaTest.testSchemaIncompatibility (96 ms)
[----------] 1 test from ProtobufNativeSchemaTest (96 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (96 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ProtobufNativeSchemaTest.testSchemaIncompatibility

 1 FAILED TEST

Anything else?

The root cause may be here:

const ::google::protobuf::Descriptor* getExternalMessageDescriptor() {
#if GOOGLE_PROTOBUF_VERSION < 3020000
::proto::external::ExternalMessage msg;
return msg.GetDescriptor();
#else
return ::proto::TestMessage::GetDescriptor();
#endif
}

If GOOGLE_PROTOBUF_VERSION >= 3020000, it will return the same message descriptor, which results in the assertion failing:

ASSERT_EQ(ResultIncompatibleSchema, createProducerResult(getExternalMessageDescriptor()));

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions