Skip to content

Commit

Permalink
Switch to ElasticMQ SQS container (#16)
Browse files Browse the repository at this point in the history
* Switch to ElasticMQ SQS container

* Update TestSQS.scala
  • Loading branch information
pjfanning authored Jul 24, 2023
1 parent 30ec8b4 commit 6da406b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ trait LocalstackBaseAwsClientTest[C <: SdkClient] extends BaseAwsClientTest[C] {
waitStrategy = Some(LocalStackReadyLogWaitStrategy)
)
}

trait ElasticMQSQSBaseAwsClientTest[C <: SdkClient] extends BaseAwsClientTest[C] {
def service: String

lazy val exposedServicePort: Int = 9324

override lazy val container: GenericContainer =
new GenericContainer(
dockerImage = "softwaremill/elasticmq-native",
exposedPorts = Seq(exposedServicePort)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package com.github.pjfanning.pekkohttpspi.sqs

import com.github.pjfanning.pekkohttpspi.{PekkoHttpAsyncHttpService, LocalstackBaseAwsClientTest}
import com.github.pjfanning.pekkohttpspi.{PekkoHttpAsyncHttpService, ElasticMQSQSBaseAwsClientTest}
import software.amazon.awssdk.auth.credentials.{AwsBasicCredentials, StaticCredentialsProvider}
import software.amazon.awssdk.services.sqs.SqsAsyncClient
import software.amazon.awssdk.services.sqs.model._

class TestSQS extends LocalstackBaseAwsClientTest[SqsAsyncClient] {
class TestSQS extends ElasticMQSQSBaseAwsClientTest[SqsAsyncClient] {
"Async SQS client" should {

"publish a message to a queue" ignore withClient { implicit client =>
"publish a message to a queue" in withClient { implicit client =>
client.createQueue(CreateQueueRequest.builder().queueName("foo").build()).join()
client
.sendMessage(SendMessageRequest.builder().queueUrl(s"$endpoint/queue/foo").messageBody("123").build())
Expand All @@ -35,7 +35,7 @@ class TestSQS extends LocalstackBaseAwsClientTest[SqsAsyncClient] {
receivedMessage.messages().get(0).body() should be("123")
}

"delete a message" ignore withClient { implicit client =>
"delete a message" in withClient { implicit client =>
client.createQueue(CreateQueueRequest.builder().queueName("foo").build()).join()
client
.sendMessage(SendMessageRequest.builder().queueUrl(s"$endpoint/queue/foo").messageBody("123").build())
Expand Down

0 comments on commit 6da406b

Please sign in to comment.