summaryrefslogtreecommitdiff
path: root/src/integrationTest/kotlin
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2024-02-29 08:47:17 +0100
committerPaul-Christian Volkmer2024-02-29 08:47:17 +0100
commit408b121f269b49da1b2dbfa4c3d7190b6df6b010 (patch)
tree1ff7c6438e6584cf1b1a8af17d48b90ed9a1da17 /src/integrationTest/kotlin
parent61e5273158406fac25efc0a715104e103a3ea540 (diff)
test: add test for max retry attempts
Diffstat (limited to 'src/integrationTest/kotlin')
-rw-r--r--src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt b/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt
index d37c251..46a756b 100644
--- a/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt
+++ b/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt
@@ -38,6 +38,7 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.boot.test.mock.mockito.MockBeans
import org.springframework.context.ApplicationContext
+import org.springframework.retry.support.RetryTemplate
import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.test.context.ContextConfiguration
@@ -276,4 +277,30 @@ class AppConfigurationTest {
}
+ @Nested
+ @TestPropertySource(
+ properties = [
+ "app.rest.uri=http://localhost:9000",
+ "app.max-retry-attempts=5"
+ ]
+ )
+ inner class AppConfigurationRetryTest(private val context: ApplicationContext) {
+
+ private val maxRetryAttempts = 5
+
+ @Test
+ fun shouldUseRetryTemplateWithConfiguredMaxAttempts() {
+ val retryTemplate = context.getBean(RetryTemplate::class.java)
+ assertThat(retryTemplate).isNotNull
+
+ assertThrows<RuntimeException> {
+ retryTemplate.execute<Void, RuntimeException> {
+ assertThat(it.retryCount).isLessThan(maxRetryAttempts)
+ throw RuntimeException()
+ }
+ }
+ }
+
+ }
+
} \ No newline at end of file