File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
test/fixtures/gcs-fixture/src/test/java/fixture/gcs Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1616import org .elasticsearch .test .ESTestCase ;
1717
1818import java .io .IOException ;
19+ import java .util .Arrays ;
1920
2021import static java .nio .charset .StandardCharsets .UTF_8 ;
2122
@@ -24,14 +25,10 @@ public class MultipartUploadTests extends ESTestCase {
2425 // produces content that does not contain boundary
2526 static String randomPartContent (int len , String boundary ) {
2627 assert len > 0 && boundary .isEmpty () == false ;
27- var n = 100 ;
28- for (var i = 0 ; i < 100 ; i ++) {
29- var content = randomAlphanumericOfLength (len );
30- if (content .contains (boundary ) == false ) {
31- return content ;
32- }
33- }
34- throw new IllegalStateException ("cannot generate part content for len=" + len + " boundary=" + boundary );
28+ var content = randomAlphanumericOfLength (len );
29+ var replacement = boundary .getBytes (UTF_8 );
30+ replacement [0 ]++; // change single char to make it different from original
31+ return content .replace (boundary , Arrays .toString (replacement ));
3532 }
3633
3734 public void testGenericMultipart () throws IOException {
You can’t perform that action at this time.
0 commit comments