Skip to content

Commit 73d5b48

Browse files
committed
Refactor integration tests: separate AIAgentBuilderIntegrationTest, rename ContextApiIntegrationTest to JavaContextApiIntegrationTest, and update workflow job configurations for clarity
Signed-off-by: Sergey Karpov <[email protected]>
1 parent e320a20 commit 73d5b48

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

.github/workflows/heavy-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
matrix:
3535
include:
3636
- job-name: "java-api-tests"
37-
test-group: "ai.koog.integration.tests.agent.Java* ai.koog.integration.tests.agent.*"
37+
test-group: "ai.koog.integration.tests.agent.Java* ai.koog.integration.tests.agent.AIAgentBuilderIntegrationTest"
3838
artifact-name: "java-api-tests"
3939
os: ubuntu-latest
4040
- job-name: "agent-tests"
41-
test-group: "ai.koog.integration.tests.agent.* --exclude-tests ai.koog.integration.tests.agent.Java* --exclude-tests ai.koog.integration.tests.agent.ContextApiIntegrationTest"
41+
test-group: "ai.koog.integration.tests.agent.* --exclude-tests ai.koog.integration.tests.agent.Java* --exclude-tests ai.koog.integration.tests.agent.AIAgentBuilderIntegrationTest"
4242
artifact-name: "agent-tests"
4343
os: ubuntu-latest
4444
- job-name: "single-llm-executor-tests"

integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests/agent/AIAgentBuilderIntegrationTest.kt renamed to integration-tests/src/jvmTest/java/ai/koog/integration/tests/agent/AIAgentBuilderIntegrationTest.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ai.koog.agents.core.agent.singleRunStrategy
77
import ai.koog.agents.core.tools.ToolRegistry
88
import ai.koog.agents.features.eventHandler.feature.EventHandler
99
import ai.koog.integration.tests.utils.Models
10-
import ai.koog.integration.tests.utils.RetryUtils.withRetry
10+
import ai.koog.integration.tests.utils.RetryUtils
1111
import ai.koog.integration.tests.utils.tools.SimpleCalculatorTool
1212
import ai.koog.prompt.llm.LLMCapability
1313
import ai.koog.prompt.llm.LLModel
@@ -21,7 +21,7 @@ import io.kotest.matchers.shouldBe
2121
import io.kotest.matchers.string.shouldContain
2222
import io.kotest.matchers.string.shouldNotBeBlank
2323
import kotlinx.coroutines.test.runTest
24-
import org.junit.jupiter.api.Assumptions.assumeTrue
24+
import org.junit.jupiter.api.Assumptions
2525
import org.junit.jupiter.api.BeforeAll
2626
import org.junit.jupiter.params.ParameterizedTest
2727
import org.junit.jupiter.params.provider.MethodSource
@@ -42,7 +42,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
4242
fun integration_BuilderBasicUsage(model: LLModel) = runTest(timeout = 180.seconds) {
4343
Models.assumeAvailable(model.provider)
4444

45-
withRetry {
45+
RetryUtils.withRetry {
4646
runWithTracking { eventHandlerConfig, state ->
4747
val agent = AIAgent.builder()
4848
.promptExecutor(getExecutor(model))
@@ -68,13 +68,13 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
6868
@MethodSource("allModels")
6969
fun integration_BuilderWithToolRegistry(model: LLModel) = runTest(timeout = 180.seconds) {
7070
Models.assumeAvailable(model.provider)
71-
assumeTrue(model.capabilities.contains(LLMCapability.Tools), "Model $model does not support tools")
71+
Assumptions.assumeTrue(model.capabilities.contains(LLMCapability.Tools), "Model $model does not support tools")
7272

73-
val toolRegistry = ToolRegistry {
73+
val toolRegistry = ToolRegistry.Companion {
7474
tool(SimpleCalculatorTool)
7575
}
7676

77-
withRetry {
77+
RetryUtils.withRetry {
7878
runWithTracking { eventHandlerConfig, state ->
7979
val agent = AIAgent.builder()
8080
.promptExecutor(getExecutor(model))
@@ -102,13 +102,13 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
102102
@MethodSource("allModels")
103103
fun integration_BuilderWithGraphStrategy(model: LLModel) = runTest(timeout = 180.seconds) {
104104
Models.assumeAvailable(model.provider)
105-
assumeTrue(model.capabilities.contains(LLMCapability.Tools), "Model $model does not support tools")
105+
Assumptions.assumeTrue(model.capabilities.contains(LLMCapability.Tools), "Model $model does not support tools")
106106

107-
val toolRegistry = ToolRegistry {
107+
val toolRegistry = ToolRegistry.Companion {
108108
tool(SimpleCalculatorTool)
109109
}
110110

111-
withRetry {
111+
RetryUtils.withRetry {
112112
runWithTracking { eventHandlerConfig, state ->
113113
val agent = AIAgent.builder()
114114
.promptExecutor(getExecutor(model))
@@ -138,7 +138,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
138138
fun integration_FunctionalStrategyWithLambda(model: LLModel) = runTest(timeout = 180.seconds) {
139139
Models.assumeAvailable(model.provider)
140140

141-
withRetry {
141+
RetryUtils.withRetry {
142142
runWithTracking { eventHandlerConfig, state ->
143143
val strategy = functionalStrategy<String, String>("echo-strategy") { input ->
144144
val response = requestLLM(
@@ -186,7 +186,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
186186
}
187187
}
188188

189-
withRetry {
189+
RetryUtils.withRetry {
190190
runWithTracking { eventHandlerConfig, state ->
191191
val agent = AIAgent.builder()
192192
.promptExecutor(getExecutor(model))
@@ -238,7 +238,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
238238
"Ideas: $ideas\n\nBest choice: $refinedIdea"
239239
}
240240

241-
withRetry {
241+
RetryUtils.withRetry {
242242
runWithTracking { eventHandlerConfig, state ->
243243
val agent = AIAgent.builder()
244244
.promptExecutor(getExecutor(model))
@@ -270,7 +270,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
270270
fun integration_BuilderMethodChaining(model: LLModel) = runTest(timeout = 180.seconds) {
271271
Models.assumeAvailable(model.provider)
272272

273-
withRetry {
273+
RetryUtils.withRetry {
274274
runWithTracking { eventHandlerConfig, state ->
275275
val agent = AIAgent.builder()
276276
.promptExecutor(getExecutor(model))
@@ -302,7 +302,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
302302
fun integration_BuilderWithMultipleFeatures(model: LLModel) = runTest(timeout = 180.seconds) {
303303
Models.assumeAvailable(model.provider)
304304

305-
withRetry {
305+
RetryUtils.withRetry {
306306
val eventCallbacks = mutableListOf<String>()
307307

308308
val agent = AIAgent.builder()
@@ -350,7 +350,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
350350
}
351351
}
352352

353-
withRetry {
353+
RetryUtils.withRetry {
354354
runWithTracking { eventHandlerConfig, state ->
355355
val agent = AIAgent.builder()
356356
.promptExecutor(getExecutor(model))
@@ -380,7 +380,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
380380
fun integration_BuilderWithTemperatureControl(model: LLModel) = runTest(timeout = 120.seconds) {
381381
Models.assumeAvailable(model.provider)
382382

383-
withRetry {
383+
RetryUtils.withRetry {
384384
runWithTracking { eventHandlerConfig, state ->
385385
val deterministicAgent = AIAgent.builder()
386386
.promptExecutor(getExecutor(model))
@@ -408,7 +408,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
408408
fun integration_BuilderWithMaxIterations(model: LLModel) = runTest(timeout = 120.seconds) {
409409
Models.assumeAvailable(model.provider)
410410

411-
withRetry {
411+
RetryUtils.withRetry {
412412
runWithTracking { eventHandlerConfig, state ->
413413
val agent = AIAgent.builder()
414414
.promptExecutor(getExecutor(model))
@@ -432,7 +432,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
432432
fun integration_FunctionalStrategyWithExceptionHandling(model: LLModel) = runTest(timeout = 120.seconds) {
433433
Models.assumeAvailable(model.provider)
434434

435-
withRetry {
435+
RetryUtils.withRetry {
436436
runWithTracking { eventHandlerConfig, state ->
437437
val strategyWithErrorHandling = functionalStrategy<String, String>("error-handling") { input ->
438438
when (val response = requestLLM(input)) {
@@ -463,7 +463,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
463463
fun integration_BuilderWithNumberOfChoices(model: LLModel) = runTest(timeout = 120.seconds) {
464464
Models.assumeAvailable(model.provider)
465465

466-
withRetry {
466+
RetryUtils.withRetry {
467467
runWithTracking { eventHandlerConfig, state ->
468468
val agent = AIAgent.builder()
469469
.promptExecutor(getExecutor(model))
@@ -489,7 +489,7 @@ class AIAgentBuilderIntegrationTest : AIAgentTestBase() {
489489
fun integration_FunctionalStrategyWithContextAccess(model: LLModel) = runTest(timeout = 120.seconds) {
490490
Models.assumeAvailable(model.provider)
491491

492-
withRetry {
492+
RetryUtils.withRetry {
493493
runWithTracking { eventHandlerConfig, state ->
494494
val strategyWithContext = functionalStrategy<String, String>("context-aware") { input ->
495495
val agentId = agentId

integration-tests/src/jvmTest/java/ai/koog/integration/tests/agent/ContextApiIntegrationTest.java renamed to integration-tests/src/jvmTest/java/ai/koog/integration/tests/agent/JavaContextApiIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static ai.koog.integration.tests.utils.LLMClientsKt.getLLMClientForProvider;
2222
import static org.junit.jupiter.api.Assertions.*;
2323

24-
public class ContextApiIntegrationTest extends KoogJavaTestBase {
24+
public class JavaContextApiIntegrationTest extends KoogJavaTestBase {
2525

2626
private final List<AutoCloseable> resourcesToClose = new ArrayList<>();
2727

0 commit comments

Comments
 (0)