Skip to content

Commit

Permalink
Fix it tests not compiling due to FutureConverters (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed May 30, 2023
1 parent b32a023 commit b659834
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: sbt githubWorkflowCheck

- name: Build project
run: sbt '++ ${{ matrix.scala }}' test
run: 'sbt ''++ ${{ matrix.scala }}'' it:compile test'

- name: Make target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
Expand Down
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ThisBuild / githubWorkflowPublish := Seq(
)
)

ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("it:compile", "test"), name = Some("Build project")))

ThisBuild / mimaPreviousArtifacts := Set.empty
ThisBuild / resolvers += "Apache Nexus Snapshots".at("https://repository.apache.org/content/repositories/snapshots/")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@

package com.github.pjfanning.pekkohttpspi.dynamodb

import com.github.pjfanning.pekkohttpspi.{PekkoHttpAsyncHttpService, TestBase}
import com.github.pjfanning.pekkohttpspi.{FutureConverters, PekkoHttpAsyncHttpService, TestBase}
import org.scalatest.concurrent.{Eventually, Futures, IntegrationPatience}
import org.scalatest.wordspec.AnyWordSpec
import org.scalatest.matchers.should.Matchers
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient
import software.amazon.awssdk.services.dynamodb.model._
import org.scalatest.concurrent.ScalaFutures._

import scala.compat.java8.FutureConverters._

class ITTestDynamoDB
extends AnyWordSpec
with Matchers
Expand Down Expand Up @@ -80,10 +78,11 @@ class ITTestDynamoDB
desc.tableName() should be(tableName)

eventually {
val response = client.describeTable(DescribeTableRequest.builder().tableName(tableName).build()).toScala
val response =
FutureConverters.asScala(client.describeTable(DescribeTableRequest.builder().tableName(tableName).build()))
response.futureValue.table().tableStatus() should be(TableStatus.ACTIVE)
}
client.deleteTable(DeleteTableRequest.builder().tableName(tableName).build()).toScala
FutureConverters.asScala(client.deleteTable(DeleteTableRequest.builder().tableName(tableName).build()))

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import scala.concurrent.Future
private[pekkohttpspi] object FutureConverters {
@inline final def asJava[T](f: Future[T]): CompletionStage[T] = scala.compat.java8.FutureConverters.toJava(f)

@inline final def asScala[T](cs: CompletionStage[T]): Future[T] = scala.compat.java8.FutureConverters.toScala(cs)

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import scala.jdk.javaapi

private[pekkohttpspi] object FutureConverters {
@inline final def asJava[T](f: Future[T]): CompletionStage[T] = javaapi.FutureConverters.asJava(f)

@inline final def asScala[T](cs: CompletionStage[T]): Future[T] = javaapi.FutureConverters.asScala(cs)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import scala.jdk.javaapi

private[pekkohttpspi] object FutureConverters {
inline final def asJava[T](f: Future[T]): CompletionStage[T] = javaapi.FutureConverters.asJava(f)

inline final def asScala[T](cs: CompletionStage[T]): Future[T] = javaapi.FutureConverters.asScala(cs)
}

0 comments on commit b659834

Please sign in to comment.