3838import software .amazon .awssdk .regions .Region ;
3939import software .amazon .awssdk .services .protocolrestjson .ProtocolRestJsonClient ;
4040import software .amazon .awssdk .services .testutil .MockIdentityProviderUtil ;
41- import software .amazon .awssdk .utils .StringUtils ;
4241
4342/**
4443 * Functional tests for WRITE_THROUGHPUT metric using WireMock.
4544 */
4645@ WireMockTest
4746public class SyncWriteThroughputMetricTest {
4847
49- // Use a larger payload to ensure multiple chunks and different first/last byte timestamps
50- private static final String LARGE_PAYLOAD = StringUtils .repeat ("x" , 128 * 1024 );
51-
5248 private MetricPublisher mockPublisher ;
5349 private ProtocolRestJsonClient client ;
5450
@@ -75,7 +71,7 @@ public void streamingInputOperation_withRequestBody_writeThroughputReported() {
7571 stubFor (post (anyUrl ())
7672 .willReturn (aResponse ().withStatus (200 ).withBody ("{}" )));
7773
78- client .streamingInputOperation (r -> r .build (), RequestBody .fromString (LARGE_PAYLOAD ));
74+ client .streamingInputOperation (r -> r .build (), RequestBody .fromString ("test body content" ));
7975
8076 ArgumentCaptor <MetricCollection > collectionCaptor = ArgumentCaptor .forClass (MetricCollection .class );
8177 verify (mockPublisher ).publish (collectionCaptor .capture ());
@@ -85,9 +81,8 @@ public void streamingInputOperation_withRequestBody_writeThroughputReported() {
8581
8682 assertThat (attemptMetrics ).hasSize (1 );
8783 List <Double > writeThroughputValues = attemptMetrics .get (0 ).metricValues (CoreMetric .WRITE_THROUGHPUT );
88- //TODO fix the test so that we are testing the write throughpt
89- // assertThat(writeThroughputValues).hasSize(1);
90- // assertThat(writeThroughputValues.get(0)).isGreaterThan(0);
84+ assertThat (writeThroughputValues ).hasSize (1 );
85+ assertThat (writeThroughputValues .get (0 )).isGreaterThan (0 );
9186 }
9287
9388 @ Test
@@ -113,7 +108,7 @@ public void nonStreamingOperation_withRequestBody_writeThroughputReported() {
113108 stubFor (post (anyUrl ())
114109 .willReturn (aResponse ().withStatus (200 ).withBody ("{}" )));
115110
116- client .allTypes (r -> r .stringMember (LARGE_PAYLOAD ));
111+ client .allTypes (r -> r .stringMember ("test" ));
117112
118113 ArgumentCaptor <MetricCollection > collectionCaptor = ArgumentCaptor .forClass (MetricCollection .class );
119114 verify (mockPublisher ).publish (collectionCaptor .capture ());
@@ -123,8 +118,7 @@ public void nonStreamingOperation_withRequestBody_writeThroughputReported() {
123118
124119 assertThat (attemptMetrics ).hasSize (1 );
125120 List <Double > writeThroughputValues = attemptMetrics .get (0 ).metricValues (CoreMetric .WRITE_THROUGHPUT );
126- //TODO fix the test so that we are testing the write throughpt
127- // assertThat(writeThroughputValues).hasSize(1);
128- // assertThat(writeThroughputValues.get(0)).isGreaterThan(0);
121+ assertThat (writeThroughputValues ).hasSize (1 );
122+ assertThat (writeThroughputValues .get (0 )).isGreaterThan (0 );
129123 }
130124}
0 commit comments