File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 11package ai.koog.integration.tests
22
3+ import ai.koog.integration.tests.utils.TestUtils.executeWithRetry
34import ai.koog.integration.tests.utils.TestUtils.readTestAnthropicKeyFromEnv
45import ai.koog.integration.tests.utils.TestUtils.readTestGoogleAIKeyFromEnv
56import ai.koog.integration.tests.utils.TestUtils.readTestOpenAIKeyFromEnv
@@ -45,9 +46,9 @@ class MultipleSystemMessagesPromptIntegrationTest {
4546 val modelAnthropic = AnthropicModels .Haiku_3_5
4647 val modelGemini = GoogleModels .Gemini2_0Flash
4748
48- val responseOpenAI = executor.execute(prompt, modelOpenAI)
49- val responseAnthropic = executor.execute(prompt, modelAnthropic)
50- val responseGemini = executor.execute(prompt, modelGemini)
49+ val responseOpenAI = executeWithRetry { executor.execute(prompt, modelOpenAI) }
50+ val responseAnthropic = executeWithRetry { executor.execute(prompt, modelAnthropic) }
51+ val responseGemini = executeWithRetry { executor.execute(prompt, modelGemini) }
5152
5253 assertTrue(responseOpenAI.content.isNotEmpty(), " OpenAI response should not be empty" )
5354 assertTrue(responseAnthropic.content.isNotEmpty(), " Anthropic response should not be empty" )
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ internal object TestUtils {
2929
3030 private const val GOOGLE_API_ERROR = " Field 'parts' is required for type with serial name"
3131 private const val GOOGLE_500_ERROR = " Error from GoogleAI API: 500 Internal Server Error"
32+ private const val GOOGLE_503_ERROR = " Error from GoogleAI API: 503 Service Unavailable"
3233
3334 suspend fun <T > executeWithRetry (operation : suspend () -> T ): T {
3435 val maxRetries = 3
@@ -39,8 +40,8 @@ internal object TestUtils {
3940 try {
4041 return operation()
4142 } catch (e: Exception ) {
42- if (e.message?.contains(GOOGLE_500_ERROR ) == true ) {
43- assumeTrue(false , " Skipping test due to GoogleAI API 500 Internal Server Error " )
43+ if (e.message?.contains(GOOGLE_500_ERROR ) == true || e.message?.contains( GOOGLE_503_ERROR ) == true ) {
44+ assumeTrue(false , " Skipping test due to ${e.message} " )
4445 } else if (e.message?.contains(GOOGLE_API_ERROR ) == true ) {
4546 lastException = e
4647 attempts++
@@ -69,8 +70,8 @@ internal object TestUtils {
6970 try {
7071 return operation()
7172 } catch (e: Exception ) {
72- if (e.message?.contains(GOOGLE_500_ERROR ) == true ) {
73- assumeTrue(false , " Skipping test due to GoogleAI API 500 Internal Server Error " )
73+ if (e.message?.contains(GOOGLE_500_ERROR ) == true || e.message?.contains( GOOGLE_503_ERROR ) == true ) {
74+ assumeTrue(false , " Skipping test due to ${e.message} } " )
7475 } else {
7576 attempts++
7677 println (" Attempt $attempts /$maxRetries failed with exception ${e.message} , retrying..." )
You can’t perform that action at this time.
0 commit comments