Skip to content

Commit

Permalink
Timeout file stream future in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dantb committed Sep 21, 2023
1 parent 69c0b02 commit ed44e74
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.duration._

import java.security.MessageDigest
import org.scalatest.concurrent.PatienceConfiguration
import org.scalatest.time.Span
import org.scalatest.time.Seconds

trait ArchiveHelpers extends ScalaFutures with EitherValuable with OptionValues {

Expand All @@ -36,7 +39,10 @@ trait ArchiveHelpers extends ScalaFutures with EitherValuable with OptionValues

def fromZip(source: Source[ByteString, Any])(implicit m: Materializer, e: ExecutionContext): ArchiveContent = {
val path = JFiles.createTempFile("test", ".zip")
source.completionTimeout(10.seconds).runWith(FileIO.toPath(path)).futureValue
source
.completionTimeout(10.seconds)
.runWith(FileIO.toPath(path))
.futureValue(PatienceConfiguration.Timeout(Span(10, Seconds)))
val result = Archive
.zipReader(path.toFile)
.mapAsync(1) { case (metadata, source) =>
Expand Down

0 comments on commit ed44e74

Please sign in to comment.