Skip to content

Commit 1fbb931

Browse files
sazonovkirillmeta-codesync[bot]
authored andcommitted
Fix flaky conformance tests: duplicate test cases, server stdout, nonconforming
Summary: Fix conformance test flakiness across round-trip and RPC test suites (24 tests). 1. TestGenerator.cpp: The empty_optional test case was generated inside the getInterestingValues() loop via addTestCase(), creating 30-50+ duplicate test cases per map type. Each duplicate sent a separate request to the hack conformance server, multiplying Queue Timeout failures. Moved the empty_optional case outside the loop so it is generated exactly once per type, matching the intended behavior. 2. conformance_server.py: Removed extra print('\n', flush=True) after port output. When the parent process closes the stdout pipe after reading the port, this extra write raised a BrokenPipeError causing the server to exit before it could handle requests. 3. rpc_server.py: Removed embedded '\n' from the port print statement (print(f"{addr.port}\n") -> print(addr.port)). The extra newline caused the parent process to read an empty second line as the port, failing to connect to the server. 4. nonconforming.txt: Added rust SinkDeclaredException test to the nonconforming list, matching the existing SinkUndeclaredException entry. This is a known runtime exception encoding non-conformance (T218969298). Reviewed By: evanjzou Differential Revision: D94987645 fbshipit-source-id: 1b93f4d909a77bf2634ac1333370452ef6a0c2d8
1 parent e1d242f commit 1fbb931

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

third-party/thrift/src/thrift/conformance/data/TestGenerator.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,22 @@ Test createRoundTripTest(
7777
// Test case #3: Optional field
7878
addStruct(mod_set<FieldModifier::Optional>{}, "Optional.");
7979

80-
addTestCase(
80+
// Test case #4: Terse field
81+
addStruct(mod_set<FieldModifier::Terse>{}, "Terse.");
82+
}
83+
84+
// Test case: Optional field with empty value (generated once, not per value)
85+
{
86+
RoundTripTestCase roundTrip;
87+
roundTrip.request()->value() = registry.store(
8188
typename struct_ByFieldType<
8289
ElementTag,
8390
mod_set<FieldModifier::Optional>>::type{},
84-
fmt::format("testset.Optional.{}/empty_optional", typeName));
85-
86-
// Test case #4: Terse field
87-
addStruct(mod_set<FieldModifier::Terse>{}, "Terse.");
91+
protocol);
92+
auto& emptyOptTestCase = test.testCases()->emplace_back();
93+
emptyOptTestCase.name() =
94+
fmt::format("testset.Optional.{}/empty_optional", typeName);
95+
emptyOptTestCase.test()->roundTrip() = roundTrip;
8896
}
8997

9098
return test;

third-party/thrift/src/thrift/conformance/python/conformance_server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ async def main():
5151
serve_task = asyncio.create_task(server.serve())
5252
addr = await server.get_address()
5353
print(addr.port, flush=True)
54-
print("\n", flush=True)
5554
try:
5655
await serve_task
5756
finally:

third-party/thrift/src/thrift/conformance/python/rpc_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def main():
7878
for signal in [SIGINT, SIGTERM]:
7979
loop.add_signal_handler(signal, server.stop)
8080
addr = await server.get_address()
81-
print(f"{addr.port}\n", flush=True)
81+
print(addr.port, flush=True)
8282
await serve_task
8383

8484

0 commit comments

Comments
 (0)