Skip to content

Commit

Permalink
trying to read application-test during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterITA committed Jun 5, 2024
1 parent a9985e7 commit eabd8b9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ lazy val fileManager = project
.settings(
name := "interop-commons-file-manager",
sharedSettings,
libraryDependencies ++= Dependencies.Jars.fileDependencies
libraryDependencies ++= Dependencies.Jars.fileDependencies,
Test / javaOptions += "-Dconfig.file=src/test/resources/application-test.conf"
)
.dependsOn(utils)
.setupBuildInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package it.pagopa.interop.commons.files

import com.typesafe.config.ConfigFactory
import com.typesafe.config.{Config, ConfigFactory}

object StorageConfiguration {
val maxConcurrency: Int = ConfigFactory.load().getInt("interop-commons.storage.max-concurrency")
val getUrlDurationMinutes: Int = ConfigFactory.load().getInt("get-url-duration-minutes")
val putUrlDurationMinutes: Int = ConfigFactory.load().getInt("put-url-duration-minutes")
val config: Config = ConfigFactory.load()

val maxConcurrency: Int = config.getInt("interop-commons.storage.max-concurrency")
val getUrlDurationMinutes: Int = config.getInt("get-url-duration-minutes")
val putUrlDurationMinutes: Int = config.getInt("put-url-duration-minutes")
}
2 changes: 2 additions & 0 deletions file-manager/src/test/resources/application-test.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get-url-duration-minutes = 5
put-url-duration-minutes = 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.io.Source
import scala.util.Success
import de.redsix.pdfcompare.CompareResultImpl

class PDFManagerSpec extends AnyWordSpecLike with Matchers {
class PDFManagerSpec extends AnyWordSpecLike with Matchers with SpecHelper {

val path = getClass.getResource(s"/pdf-template-html.txt").getPath
val pdfTemplate = Source.fromFile(new File(path)).mkString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class S3FileManagerTest
with Matchers
with ScalaFutures
with BeforeAndAfterAll
with BeforeAndAfterEach {
with BeforeAndAfterEach
with SpecHelper {

override implicit val patienceConfig: PatienceConfig = new PatienceConfig(Span(1, Seconds))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package it.pagopa.interop.commons.files

import com.typesafe.config.{Config, ConfigFactory}

trait SpecHelper {

val testData = ConfigFactory.parseString(s"""
get-url-duration-minutes = 5
get-url-duration-minutes = 1
""")

val config: Config = ConfigFactory
.parseResourcesAnySyntax("application-test")
.withFallback(testData)
}

0 comments on commit eabd8b9

Please sign in to comment.