Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventually does not succeed when working with AWS SQS queues after upgrade to 5.8.1 #3991

Open
bharath154 opened this issue May 1, 2024 · 1 comment

Comments

@bharath154
Copy link

bharath154 commented May 1, 2024

Which version of Kotest are you using
5.8.1

When running eventually block to wait for the messages to appear on the SQS queue after draining from DLQ the message does not appear at all. This is with software.amazon.awssdk:sqs:2.25.18.

May be some change got introduced in one of the pinned modules below, which caused this regression.

In our project's gradle file, if I pin some modules to 5.8.0 the tests works fine.

kotest = "5.8.1"
kotestPinned = "5.8.0"
kotestExtensionsArrow = "1.4.0"
kotestExtensionsSpring = "1.1.3"
...
kotest-runnerJUnit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotestPinned" }
kotest-frameworkDatatest = { module = "io.kotest:kotest-framework-datatest", version.ref = "kotestPinned" }
kotest-extensionsJunitXml = { module = "io.kotest:kotest-extensions-junitxml", version.ref = "kotestPinned" }
kotest-assertionsCore = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" }
kotest-assertionsJson = { module = "io.kotest:kotest-assertions-json", version.ref = "kotest" }
kotest-propertyArrow = { module = "io.kotest.extensions:kotest-property-arrow", version.ref = "kotestExtensionsArrow" }
kotest-assertionsArrow = { module = "io.kotest.extensions:kotest-assertions-arrow", version.ref = "kotestExtensionsArrow" }
kotest-extensionsSpring = { module = "io.kotest.extensions:kotest-extensions-spring", version.ref = "kotestExtensionsSpring" }

Sample code, might need to import relevant libraries like AWS SQS etc.,

Code:

    private val EVENTUALLY_CONFIG = eventuallyConfig {
      duration = 5000.milliseconds()
      interval = 300.milliseconds()
    }

    test("should trigger rehydration from account events DLQ") {
        checkAll(5, arbEvent) { event ->
          purgeQueues()
          sqs.publishToQueue(accountEventsQueue, Queue.DeadLetter, event)

          drainDLQRequest("""{ "queue": "account-events" }""") shouldRespond { response: DrainDLQResponse ->
            status shouldBe HttpStatus.ACCEPTED
            response shouldBe DrainDLQResponse(QueueName.AccountEvents)

            eventually(EVENTUALLY_CONFIG) {
              sqs.getQueueAttributes(accountEventsQueue, Queue.Primary).approximateNumberOfMessages shouldBe 1L
              sqs.getQueueAttributes(
                accountEventsQueue,
                Queue.DeadLetter
              ).approximateNumberOfMessages shouldBe 0L
            }
          }
          sqs.receive(accountEventsQueue).map { it.payload } shouldContainExactly listOf(event)
        }
      }

  private fun drainDLQRequest(body: String) =
    client // webTestClient
      .post()
      .uri("/drainDLQ")
      .contentType(MediaType.APPLICATION_JSON)
      .bodyValue(body)

Returns the below error when the whole test suite is run:
Caused by java.lang.AssertionError: Block failed after 5s; attempted 14 time(s)

May be related to #3988

@mirageoasis
Copy link
Contributor

think your issue with 3988 is related to overflow in default state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants