Skip to content

Commit

Permalink
Make SingleFilePageSwapperTest ignore the irrelevant crashes of the e…
Browse files Browse the repository at this point in the history
…xternal locker process.
  • Loading branch information
chrisvest committed May 3, 2018
1 parent 960c6a6 commit 9d0f1aa
Showing 1 changed file with 20 additions and 2 deletions.
Expand Up @@ -59,6 +59,7 @@
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeThat;
import static org.neo4j.test.matchers.ByteArrayMatcher.byteArray; import static org.neo4j.test.matchers.ByteArrayMatcher.byteArray;


public class SingleFilePageSwapperTest extends PageSwapperTest public class SingleFilePageSwapperTest extends PageSwapperTest
Expand Down Expand Up @@ -309,8 +310,25 @@ public void creatingSwapperForExternallyLockedFileMustThrow() throws Exception
File wd = new File( "target/test-classes" ).getAbsoluteFile(); File wd = new File( "target/test-classes" ).getAbsoluteFile();
pb.directory( wd ); pb.directory( wd );
Process process = pb.start(); Process process = pb.start();
BufferedReader reader = new BufferedReader( new InputStreamReader( process.getInputStream() ) ); BufferedReader stdout = new BufferedReader( new InputStreamReader( process.getInputStream() ) );
assertThat( reader.readLine(), is( LockThisFileProgram.LOCKED_OUTPUT ) ); InputStream stderr = process.getErrorStream();
try
{
assumeThat( stdout.readLine(), is( LockThisFileProgram.LOCKED_OUTPUT ) );
}
catch ( Throwable e )
{
int b = stderr.read();
while ( b != -1 )
{
System.err.write( b );
b = stderr.read();
}
System.err.flush();
int exitCode = process.waitFor();
System.out.println( "exitCode = " + exitCode );
throw e;
}


try try
{ {
Expand Down

0 comments on commit 9d0f1aa

Please sign in to comment.