Topic name question about vt6: List for an unknown topic

I got a test fail when testing this:Expected TopicResponse[0] Topic Name to be unknown-topic-quz, got unknown-topic-quz
It looks the name is just the same as the test case expected, andI checked everything include source code, kafka response format, hexdump of request and response, everything looks fine.
Here is the log:

remote: [tester::#VT6] Running tests for Stage #VT6 (Listing Partitions - List for an unknown topic)
remote: [tester::#VT6] $ ./your_program.sh /tmp/server.properties
remote: [tester::#VT6] Connecting to broker at: localhost:9092
remote: [your_program] 启动 Kafka 服务器...
remote: [tester::#VT6] Connection to broker at localhost:9092 successful
remote: [tester::#VT6] Sending "DescribeTopicPartitions" (version: 0) request (Correlation id: 1472045599)
remote: [tester::#VT6] Hexdump of sent "DescribeTopicPartitions" request: 
remote: [tester::#VT6] Idx  | Hex                                             | ASCII
remote: [tester::#VT6] -----+-------------------------------------------------+-----------------
remote: [tester::#VT6] 0000 | 00 00 00 31 00 4b 00 00 57 bd a2 1f 00 0c 6b 61 | ...1.K..W.....ka
remote: [tester::#VT6] 0010 | 66 6b 61 2d 74 65 73 74 65 72 00 02 12 75 6e 6b | fka-tester...unk
remote: [tester::#VT6] 0020 | 6e 6f 77 6e 2d 74 6f 70 69 63 2d 71 75 7a 00 00 | nown-topic-quz..
remote: [tester::#VT6] 0030 | 00 00 01 ff 00                                  | .....
remote: [tester::#VT6] 
remote: [your_program] 接受来自 ('::1', 53734, 0, 0) 的连接
remote: [your_program] 请求大小: 49 bytes
remote: [your_program] 收到数据: b'\x00K\x00\x00W\xbd\xa2\x1f\x00\x0ckafka-tester\x00\x02\x12unknown-topic-quz\x00\x00\x00\x00\x01\xff\x00'
remote: [your_program] 处理请求
remote: [your_program] 发送响应
remote: [tester::#VT6] Hexdump of received "DescribeTopicPartitions" response: 
remote: [tester::#VT6] Idx  | Hex                                             | ASCII
remote: [tester::#VT6] -----+-------------------------------------------------+-----------------
remote: [tester::#VT6] 0000 | 00 00 00 38 57 bd a2 1f 00 00 00 00 00 02 00 03 | ...8W...........
remote: [tester::#VT6] 0010 | 13 12 75 6e 6b 6e 6f 77 6e 2d 74 6f 70 69 63 2d | ..unknown-topic-
remote: [tester::#VT6] 0020 | 71 75 7a 00 00 00 00 00 00 00 00 00 00 00 00 00 | quz.............
remote: [tester::#VT6] 0030 | 00 00 00 00 00 00 00 00 00 00 ff 00             | ............
remote: [tester::#VT6] 
remote: [tester::#VT6] [Decoder] - .ResponseHeader
remote: [tester::#VT6] [Decoder]   - .correlation_id (1472045599)
remote: [tester::#VT6] [Decoder]   - .TAG_BUFFER
remote: [tester::#VT6] [Decoder] - .ResponseBody
remote: [tester::#VT6] [Decoder]   - .throttle_time_ms (0)
remote: [tester::#VT6] [Decoder]   - .topic.length (1)
remote: [tester::#VT6] [Decoder]   - .Topics[0]
remote: [tester::#VT6] [Decoder]     - .error_code (3)
remote: [tester::#VT6] [Decoder]     - .name (unknown-topic-quz)
remote: [tester::#VT6] [Decoder]     - .topic_id (00000000-0000-0000-0000-000000000000)
remote: [tester::#VT6] [Decoder]     - .is_internal (false)
remote: [tester::#VT6] [Decoder]     - .num_partitions (0)
remote: [tester::#VT6] [Decoder]     - .topic_authorized_operations (0)
remote: [tester::#VT6] [Decoder]     - .TAG_BUFFER
remote: [tester::#VT6] [Decoder]   - .next_cursor (null)
remote: [tester::#VT6] [Decoder]   - .TAG_BUFFER
remote: [tester::#VT6] ✓ Correlation ID: 1472045599
remote: [tester::#VT6] ✓ Throttle Time: 0
remote: [tester::#VT6]   ✓ TopicResponse[0] Error code: 3
remote: [tester::#VT6] Expected TopicResponse[0] Topic Name to be unknown-topic-quz, got unknown-topic-quz
remote: [tester::#VT6] Test failed
remote: [tester::#VT6] Terminating program
remote: [tester::#VT6] Program terminated successfully

Hi @tmfc, could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

Hi Andy,
Thank you for replying.

I have published my code to GitHub, here it is: GitHub - tmfc/codecrafters-kafka-python

@tmfc Sorry for the delayed response!

Looks like the CompactString of topic_names was encoded as CompactString again:

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.