Skip to content

Commit

Permalink
Changing a string to key:value pair to fix flakiness in `testSerializ…
Browse files Browse the repository at this point in the history
…ationWithDefaults` (#15317)

* + Fix for Flaky Test

* + Replacing TreeMap with LinkedHashMap

* + Changing data structure from LinkedHashMap to HashMap

* Fixed flaky test in S3DataSegmentPusherConfigTest.testSerializationValidatingMaxListingLength

* Minor Changes
  • Loading branch information
krishnanand5 authored Nov 14, 2023
1 parent 2cb7443 commit 06744d3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import javax.validation.Validation;
import javax.validation.Validator;
import java.io.IOException;
import java.util.Map;
import java.util.Set;

public class S3DataSegmentPusherConfigTest
Expand All @@ -51,9 +52,10 @@ public void testSerializationWithDefaults() throws IOException
String jsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\"}";
String expectedJsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\","
+ "\"disableAcl\":false,\"maxListingLength\":1024,\"useS3aSchema\":false}";

S3DataSegmentPusherConfig config = JSON_MAPPER.readValue(jsonConfig, S3DataSegmentPusherConfig.class);
Assert.assertEquals(expectedJsonConfig, JSON_MAPPER.writeValueAsString(config));
Map<String, String> expected = JSON_MAPPER.readValue(expectedJsonConfig, Map.class);
Map<String, String> actual = JSON_MAPPER.readValue(JSON_MAPPER.writeValueAsString(config), Map.class);
Assert.assertEquals(expected, actual);
}

@Test
Expand Down

0 comments on commit 06744d3

Please sign in to comment.