Skip to content

Commit 737f397

Browse files
authored
CI Fix to Prevent Checks Dealing with Large Array Sizes (#459)
* Fix spacing with comment * Updated code * Test: Added Assume catches for each failed tests * Added and implemented separate method to check if System CI is false * Added a null check to ensure assumingCIIsFalse() method runs locally as well * Changed assumeTrue to assumeFalse
1 parent d004255 commit 737f397

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/test/java/org/xerial/snappy/SnappyTest.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.IOException;
3131
import java.nio.ByteBuffer;
3232

33+
import org.junit.Assume;
3334
import org.junit.Assert;
3435
import org.junit.Test;
3536
import org.xerial.util.log.Logger;
@@ -415,31 +416,37 @@ public void isValidArrayInputLength()
415416
*/
416417
@Test(expected = SnappyError.class)
417418
public void isTooLargeDoubleArrayInputLength() throws Exception {
419+
assumingCIIsFalse();
418420
Snappy.compress(new double[Integer.MAX_VALUE / 8 + 1]);
419421
}
420422

421423
@Test(expected = SnappyError.class)
422424
public void isTooLargeCharArrayInputLength() throws Exception {
425+
assumingCIIsFalse();
423426
Snappy.compress(new char[Integer.MAX_VALUE / 2 + 1]);
424427
}
425428

426429
@Test(expected = SnappyError.class)
427430
public void isTooLargeFloatArrayInputLength() throws Exception {
431+
assumingCIIsFalse();
428432
Snappy.compress(new float[Integer.MAX_VALUE / 4 + 1]);
429433
}
430434

431435
@Test(expected = SnappyError.class)
432436
public void isTooLargeIntArrayInputLength() throws Exception {
437+
assumingCIIsFalse();
433438
Snappy.compress(new int[Integer.MAX_VALUE / 4 + 1]);
434439
}
435440

436441
@Test(expected = SnappyError.class)
437442
public void isTooLargeLongArrayInputLength() throws Exception {
443+
assumingCIIsFalse();
438444
Snappy.compress(new long[Integer.MAX_VALUE / 8 + 1]);
439445
}
440446

441447
@Test(expected = SnappyError.class)
442448
public void isTooLargeShortArrayInputLength() throws Exception {
449+
assumingCIIsFalse();
443450
Snappy.compress(new short[Integer.MAX_VALUE / 2 + 1]);
444451
}
445452

@@ -474,28 +481,37 @@ public void isValidArrayInputLengthForBitShuffleShuffle()
474481
*/
475482
@Test(expected = SnappyError.class)
476483
public void isTooLargeDoubleArrayInputLengthForBitShuffleShuffle() throws Exception {
484+
assumingCIIsFalse();
477485
BitShuffle.shuffle(new double[Integer.MAX_VALUE / 8 + 1]);
478486
}
479487

480488
@Test(expected = SnappyError.class)
481489
public void isTooLargeFloatArrayInputLengthForBitShuffleShuffle() throws Exception {
490+
assumingCIIsFalse();
482491
BitShuffle.shuffle(new float[Integer.MAX_VALUE / 4 + 1]);
483492
}
484493

485494
@Test(expected = SnappyError.class)
486495
public void isTooLargeIntArrayInputLengthForBitShuffleShuffle() throws Exception {
496+
assumingCIIsFalse();
487497
BitShuffle.shuffle(new float[Integer.MAX_VALUE / 4 + 1]);
488498
}
489499

490500
@Test(expected = SnappyError.class)
491501
public void isTooLargeLongArrayInputLengthForBitShuffleShuffle() throws Exception {
502+
assumingCIIsFalse();
492503
BitShuffle.shuffle(new long[Integer.MAX_VALUE / 8 + 1]);
493504
}
494505

495506
@Test(expected = SnappyError.class)
496507
public void isTooLargeShortArrayInputLengthForBitShuffleShuffle() throws Exception {
508+
assumingCIIsFalse();
497509
BitShuffle.shuffle(new short[Integer.MAX_VALUE / 2 + 1]);
510+
}
498511

499-
512+
private void assumingCIIsFalse() {
513+
if (System.getenv("CI") == null)
514+
return;
515+
Assume.assumeFalse("Skipped on CI", System.getenv("CI").equals("true"));
500516
}
501517
}

0 commit comments

Comments
 (0)