Skip to content

Commit

Permalink
Add faster running test we dont have to ignore.
Browse files Browse the repository at this point in the history
Avoid Files max size validation to ensure buffering is working. Same
test fails with same messageless error reported by user against master.
  • Loading branch information
melowe committed Apr 23, 2019
1 parent ca4cebc commit 40ff888
Showing 1 changed file with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package com.quorum.tessera.data.migration;

import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;
import org.junit.Ignore;

public class DirectoryStoreFileTest {

Expand All @@ -31,32 +27,21 @@ public void load() throws Exception {

}

@Ignore
@Test
public void loadLarge() throws Exception {

Path baseDir = Paths.get(getClass().getResource("/").toURI());

Path directory = baseDir.resolve(UUID.randomUUID().toString());

Files.createDirectories(directory);

Path largeFile = Paths.get(directory.toAbsolutePath().toString(), "loadLarge");

try (java.io.BufferedWriter writer = Files.newBufferedWriter(largeFile)) {
IntStream.range(1, 50000000)
.mapToObj(i -> UUID.randomUUID())
.map(UUID::toString)
.map(String::getBytes)
.map(Base64.getEncoder()::encodeToString)
.forEach(s -> {
try {
writer.write(s);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
});
}
Random random = new Random();
byte[] data = new byte[Integer.MAX_VALUE - 8];
random.nextBytes(data);
Files.write(largeFile, data);

DirectoryStoreFile directoryStoreFile = new DirectoryStoreFile();

Expand Down

0 comments on commit 40ff888

Please sign in to comment.