File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
services-custom/s3-transfer-manager/src/it/java/software/amazon/awssdk/transfer/s3 Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 3131import org .apache .logging .log4j .Level ;
3232import org .assertj .core .api .Assertions ;
3333import org .junit .jupiter .api .AfterAll ;
34+ import org .junit .jupiter .api .Assumptions ;
3435import org .junit .jupiter .api .BeforeAll ;
3536import org .junit .jupiter .params .ParameterizedTest ;
3637import org .junit .jupiter .params .provider .MethodSource ;
@@ -149,8 +150,13 @@ void pauseAndResume_ObjectNotChanged_shouldResumeDownload(S3TransferManager tm)
149150 log .debug (() -> "Paused: " + resumableFileDownload );
150151 assertEqualsBySdkFields (resumableFileDownload .downloadFileRequest (), request );
151152 assertThat (testDownloadListener .getObjectResponse ).isNotNull ();
153+
154+ // Skip the test if everything has been downloaded.
155+ Assumptions .assumeTrue (resumableFileDownload .bytesTransferred () < sourceFile .length ());
156+
152157 assertThat (resumableFileDownload .s3ObjectLastModified ()).hasValue (testDownloadListener .getObjectResponse .lastModified ());
153- assertThat (bytesTransferred ).isEqualTo (path .toFile ().length ());
158+ // Request may not be cancelled right away when pause is invoked, so there may be more bytes written to the file
159+ assertThat (bytesTransferred ).isLessThanOrEqualTo (path .toFile ().length ());
154160 assertThat (resumableFileDownload .totalSizeInBytes ()).hasValue (sourceFile .length ());
155161 assertThat (bytesTransferred ).isLessThanOrEqualTo (sourceFile .length ());
156162 assertThat (download .completionFuture ()).isCancelled ();
You can’t perform that action at this time.
0 commit comments