iemejia commented on code in PR #3860:
URL: https://github.com/apache/avro/pull/3860#discussion_r3567589054
##########
lang/csharp/src/apache/test/IO/BinaryCodecTests.cs:
##########
@@ -38,6 +39,24 @@ namespace Avro.Test
[TestFixture]
public class BinaryCodecTests
{
+ private string _previousMaxCollectionItems;
+
+ // The collection-limit tests assume the default caps.
AVRO_MAX_COLLECTION_ITEMS
+ // overrides them, so a value set in the shell/CI could make these
tests
+ // flaky (or reject a legitimate array). Clear it for each test and
restore
+ // it afterward so the tests are deterministic against the defaults.
+ [SetUp]
+ public void ClearCollectionItemsEnv()
+ {
+ _previousMaxCollectionItems =
Environment.GetEnvironmentVariable("AVRO_MAX_COLLECTION_ITEMS");
+ Environment.SetEnvironmentVariable("AVRO_MAX_COLLECTION_ITEMS",
null);
+ }
Review Comment:
You're right — the limits are `static readonly`, computed once at class
load, so the runtime [SetUp] clearing had no effect. I've reverted the
ineffective [SetUp]/[TearDown] and documented that these tests assume the
process wasn't started with a custom AVRO_MAX_COLLECTION_ITEMS (the normal
case). Making the tests fully override-independent would require the caps to be
re-readable rather than static readonly (a production change), which is out of
scope here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]