Skip to content

Commit

Permalink
Add actor cleanup to S3Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Sep 27, 2022
1 parent d9e647b commit 19e16dc
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core-s3/src/test/scala/io/aiven/guardian/kafka/s3/S3Spec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,18 @@ trait S3Spec
}

override def afterAll(): Unit =
enableCleanup match {
case Some(initialDelay) =>
def cleanAllBuckets = {
val futures = bucketsToCleanup.asScala.toList.distinct.map(cleanBucket)
Future.sequence(futures)
}

Await.result(akka.pattern.after(initialDelay)(cleanAllBuckets), maxCleanupTimeout)
case None => ()
}
try
enableCleanup match {
case Some(initialDelay) =>
Await.result(akka.pattern.after(initialDelay)(
Future.sequence(bucketsToCleanup.asScala.toList.distinct.map(cleanBucket))
),
maxCleanupTimeout
)
case None => ()
}
finally
super.afterAll()

/** @param dataBucket
* Which S3 bucket the objects are being persisted into
Expand Down

0 comments on commit 19e16dc

Please sign in to comment.