mirror of
https://github.com/airsonic/airsonic.git
synced 2025-10-03 01:39:34 +02:00
Write integration test outputs to target directory
This commit is contained in:
parent
032987d97c
commit
f3901cfb11
2 changed files with 7 additions and 0 deletions
|
@ -201,6 +201,7 @@
|
|||
<DockerTestingHost>${docker.testing.host}</DockerTestingHost>
|
||||
<!-- This is the folder on the host (not on the container), used in org.airsonic.test.Scanner -->
|
||||
<DockerTestingDefaultMusicFolder>${docker.testing.default-music-folder}</DockerTestingDefaultMusicFolder>
|
||||
<IntegrationTestsOutputDirectory>${project.build.directory}/data/responses</IntegrationTestsOutputDirectory>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package org.airsonic.test;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -38,6 +40,10 @@ public class StreamIT {
|
|||
byte[] fromServer = Scanner.getMediaFileData(mediaFileId);
|
||||
String expectedBodyResource = String.format("/blobs/stream/" + file + "/responses/1.dat");
|
||||
byte[] expected = IOUtils.toByteArray(StreamIT.class.getResourceAsStream(expectedBodyResource));
|
||||
if (!StringUtils.isBlank(System.getProperty("IntegrationTestsOutputDirectory", ""))) {
|
||||
Path fromServerPath = Paths.get(System.getProperty("IntegrationTestsOutputDirectory", ""), file + ".dat");
|
||||
FileUtils.writeByteArrayToFile(fromServerPath.toFile(), fromServer);
|
||||
}
|
||||
assertThat(fromServer).containsExactly(expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue