~bigbes/tarantool

tarantool-protobuf

a9036f1d34123c3426fbecaac4635a844e042acb — Eugene Blikh 3 months ago 5fa0fd0
conformance: dispatch proto2 TestAllTypesProto2

Register the proto2 test message in MESSAGE_REGISTRY and the
Any/JSON registry. The harness now picks up 1312 previously-skipped
binary + JSON cases; whole suite jumps to 2805 ✓ / 0 failures (was
1493 ✓ with proto2 fully skipped).

Text-format suite still has 16 unexpected failures, all bound up
in proto2 group-field text syntax (CamelCase submessage label, no
mandatory `:` before `{`, extension-bracketed group form). Tackled
in the next commit.

The conformance unit test that pinned the proto2-skipped behavior
now targets an editions test type instead so the skip-path still
has a hard assertion.
2 files changed, 12 insertions(+), 6 deletions(-)

M cmd/conformance/core.lua
M test/conformance_test.lua
M cmd/conformance/core.lua => cmd/conformance/core.lua +8 -4
@@ 11,23 11,27 @@
local pb           = require('pb')
local conformance  = require('full.conformance.conformance_pb')
local proto3_tests = require('full.protobuf_test_messages.proto3.test_messages_proto3_pb')
local proto2_tests = require('full.protobuf_test_messages.proto2.test_messages_proto2_pb')

local M = {}

-- Map of supported `message_type` -> descriptor. Any other message type
-- yields a `skipped` response so we don't claim conformance for protos we
-- don't actually support yet (proto2, editions).
-- don't actually support yet (editions; MessageSet-flavored proto2 schemas
-- still need work — those tests appear as runtime/parse errors below).
local MESSAGE_REGISTRY = {
    ['protobuf_test_messages.proto3.TestAllTypesProto3'] =
        proto3_tests.TestAllTypesProto3_descriptor,
    ['protobuf_test_messages.proto2.TestAllTypesProto2'] =
        proto2_tests.TestAllTypesProto2_descriptor,
    ['conformance.FailureSet'] =
        conformance.FailureSet_descriptor,
}

-- Register the test message in the runtime's WKT registry so Any fields
-- with `@type` pointing at a non-WKT user type (the conformance suite uses
-- TestAllTypesProto3 itself inside some Any tests) resolve in JSON decode.
-- Register test messages in the runtime's Any/WKT registry so JSON Any
-- fields with `@type` pointing at our test types resolve on decode.
pb.register(proto3_tests.TestAllTypesProto3_descriptor)
pb.register(proto2_tests.TestAllTypesProto2_descriptor)

local WIRE_FORMAT = conformance.WireFormat
local PROTOBUF    = WIRE_FORMAT.PROTOBUF

M test/conformance_test.lua => test/conformance_test.lua +4 -2
@@ 121,11 121,13 @@ core_g.test_parse_error_on_malformed_json = function()
end

core_g.test_unsupported_message_type_skipped = function()
    -- proto2 / editions test message types are intentionally unsupported.
    -- Editions test message types are intentionally unsupported. Proto2
    -- moved into the registry once codegen landed; pick a type that's
    -- explicitly absent so this pin still demonstrates the skip path.
    local resp = decode_resp(core.handle_request(encode_req({
        protobuf_payload = '',
        requested_output_format = PROTOBUF,
        message_type = 'protobuf_test_messages.proto2.TestAllTypesProto2',
        message_type = 'protobuf_test_messages.editions.TestAllTypesEdition2023',
    })))
    t.assert_str_contains(resp.skipped or '', 'unsupported message type')
end