Skip to content

Commit 31963a9

Browse files
committed
Add logging configuration and enhance error handling test logging
1 parent fe437e6 commit 31963a9

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎src/test/java/com/github/copilot/sdk/ErrorHandlingTest.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import static org.junit.jupiter.api.Assertions.*;
88

99
import java.util.ArrayList;
10+
import java.util.logging.Logger;
1011
import java.util.List;
1112
import java.util.concurrent.CompletableFuture;
1213
import java.util.concurrent.TimeUnit;
@@ -33,6 +34,7 @@
3334
*/
3435
public class ErrorHandlingTest {
3536

37+
private static final Logger LOG = Logger.getLogger(ErrorHandlingTest.class.getName());
3638
private static E2ETestContext ctx;
3739

3840
@BeforeAll
@@ -52,6 +54,7 @@ static void teardown() throws Exception {
5254
*/
5355
@Test
5456
void testToolErrorDoesNotCrashSession() throws Exception {
57+
LOG.info("Running test: testToolErrorDoesNotCrashSession");
5558
ctx.configureForTest("tools", "handles_tool_calling_errors");
5659

5760
List<AbstractSessionEvent> allEvents = new ArrayList<>();
@@ -89,6 +92,7 @@ void testToolErrorDoesNotCrashSession() throws Exception {
8992
*/
9093
@Test
9194
void testToolReturnsFailureResult() throws Exception {
95+
LOG.info("Running test: testToolReturnsFailureResult");
9296
ctx.configureForTest("tools", "handles_tool_calling_errors");
9397

9498
ToolDefinition failTool = ToolDefinition.create("get_user_location", "Gets the user's location",
@@ -117,6 +121,7 @@ void testToolReturnsFailureResult() throws Exception {
117121
*/
118122
@Test
119123
void testPermissionHandlerErrorDeniesPermission() throws Exception {
124+
LOG.info("Running test: testPermissionHandlerErrorDeniesPermission");
120125
ctx.configureForTest("permissions", "should_handle_permission_handler_errors_gracefully");
121126

122127
List<SessionErrorEvent> errorEvents = new ArrayList<>();
@@ -153,6 +158,7 @@ void testPermissionHandlerErrorDeniesPermission() throws Exception {
153158
*/
154159
@Test
155160
void testSessionErrorEventContainsDetails() throws Exception {
161+
LOG.info("Running test: testSessionErrorEventContainsDetails");
156162
ctx.configureForTest("permissions", "permission_handler_errors");
157163

158164
List<SessionErrorEvent> errorEvents = new ArrayList<>();
@@ -171,7 +177,9 @@ void testSessionErrorEventContainsDetails() throws Exception {
171177
});
172178

173179
try {
174-
session.sendAndWait(new MessageOptions().setPrompt("Run 'ls' command")).get(60, TimeUnit.SECONDS);
180+
// Use prompt that matches the snapshot
181+
session.sendAndWait(new MessageOptions().setPrompt("Run 'echo test'. If you can't, say 'failed'."))
182+
.get(60, TimeUnit.SECONDS);
175183
} catch (Exception e) {
176184
// Error is expected in some cases
177185
}
@@ -189,6 +197,7 @@ void testSessionErrorEventContainsDetails() throws Exception {
189197
*/
190198
@Test
191199
void testSessionContinuesAfterToolError() throws Exception {
200+
LOG.info("Running test: testSessionContinuesAfterToolError");
192201
ctx.configureForTest("tools", "handles_tool_calling_errors");
193202

194203
ToolDefinition errorTool = ToolDefinition.create("get_user_location", "Gets the user's location",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
handlers=java.util.logging.ConsoleHandler
2+
java.util.logging.ConsoleHandler.level=INFO
3+
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
4+
java.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL %4$-7s [%3$s] %5$s%6$s%n
5+
6+
com.github.copilot.sdk.level=INFO
7+
8+
.level=INFO

0 commit comments

Comments
 (0)