Skip to content

Commit

Permalink
wip - migrate to play 3.0 - fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Nov 9, 2023
1 parent 41c1267 commit dd8c434
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions daikoku/test/daikoku/ApiControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3510,7 +3510,7 @@ class ApiControllerSpec()
adminPlan.otoroshiTarget.get.otoroshiSettings mustBe OtoroshiSettingsId(
"wiremock"
)
adminPlan.otoroshiTarget.get.authorizedEntities.value.groups should contain(
adminPlan.otoroshiTarget.get.authorizedEntities.value.groups must contain(
OtoroshiServiceGroupId("daikoku-admin-api-group-id")
)
}
Expand Down Expand Up @@ -4487,7 +4487,7 @@ class ApiControllerSpec()
.findById((resp.json \ "subscription" \ "_id").as[String])
.map {
case Some(sub) => sub.apiKey.clientId mustBe parentApiKeyClientId
case None => fail
case None => fail()
}
}
"be transformed in unique api key when the subscription hasn't parent" in {
Expand Down
1 change: 1 addition & 0 deletions daikoku/test/daikoku/TenantControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fr.maif.otoroshi.daikoku.domain.json.SeqCmsHistoryFormat
import fr.maif.otoroshi.daikoku.domain._
import fr.maif.otoroshi.daikoku.login.AuthProvider
import fr.maif.otoroshi.daikoku.tests.utils.{DaikokuSpecHelper, OneServerPerSuiteWithMyComponents}
import fr.maif.otoroshi.daikoku.utils.IdGenerator
import org.scalatest.concurrent.IntegrationPatience
import org.scalatestplus.play.PlaySpec
import play.api.libs.json._
Expand Down
20 changes: 11 additions & 9 deletions daikoku/test/daikoku/suites.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import fr.maif.otoroshi.daikoku.domain._
import fr.maif.otoroshi.daikoku.login.AuthProvider
import fr.maif.otoroshi.daikoku.modules.DaikokuComponentsInstances
import fr.maif.otoroshi.daikoku.utils.IdGenerator
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.Materializer
import org.joda.time.DateTime
import org.jsoup.nodes.Document
import org.mindrot.jbcrypt.BCrypt
Expand All @@ -26,7 +28,7 @@ import java.nio.charset.StandardCharsets
import java.nio.file.{Files, StandardCopyOption}
import java.util.concurrent.TimeUnit
import scala.concurrent.duration._
import scala.concurrent.{Await, Future, Promise}
import scala.concurrent.{Await, ExecutionContext, Future, Promise}
import scala.sys.process.ProcessLogger
import scala.util.{Failure, Success, Try}

Expand All @@ -36,7 +38,7 @@ class DaikokuSuites extends Suite with BeforeAndAfterAll { thisSuite =>

override protected def afterAll(): Unit = {}

override def toString: String = thisSuite.toString
// override def toString: String = thisSuite.toString
}

case class ApiWithPlans(api: Api, plans: Seq[UsagePlan])
Expand All @@ -63,14 +65,14 @@ object utils {

trait DaikokuSpecHelper { suite: OneServerPerSuiteWithMyComponents =>

implicit val ec = daikokuComponents.env.defaultExecutionContext
implicit val as = daikokuComponents.env.defaultActorSystem
implicit val mat = daikokuComponents.env.defaultMaterializer
implicit val ec: ExecutionContext = daikokuComponents.env.defaultExecutionContext
implicit val as: ActorSystem = daikokuComponents.env.defaultActorSystem
implicit val mat: Materializer = daikokuComponents.env.defaultMaterializer

val logger = Logger.apply("daikoku-spec-helper")
val logger: Logger = Logger.apply("daikoku-spec-helper")

def await(duration: FiniteDuration): Unit = {
val p = Promise[Unit]
val p = Promise[Unit]()
daikokuComponents.env.defaultActorSystem.scheduler
.scheduleOnce(duration) {
p.trySuccess(())
Expand All @@ -79,7 +81,7 @@ object utils {
}

def awaitF(duration: FiniteDuration): Future[Unit] = {
val p = Promise[Unit]
val p = Promise[Unit]()
daikokuComponents.actorSystem.scheduler.scheduleOnce(duration) {
p.trySuccess(())
}
Expand Down Expand Up @@ -598,7 +600,7 @@ object utils {
"/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome",
"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome"
)
val promise = Promise[String]
val promise = Promise[String]()
execs.find { exec =>
var stdout = Seq.empty[String]
val log = ProcessLogger { str =>
Expand Down

0 comments on commit dd8c434

Please sign in to comment.