Skip to content

Fix runClaudeUpdate test failure in claude-runner-integration.test.ts #42

Description

@frankbria

Description

The runClaudeUpdate test in tests/e2b/claude-runner-integration.test.ts is failing when E2B_API_KEY is available.

Test Location

  • File: tests/e2b/claude-runner-integration.test.ts:60-69
  • Test Name: should update Claude to latest version

Error

AssertionError: expected false to be true // Object.is equality

- Expected
+ Received

- true
+ false

 ❯ tests/e2b/claude-runner-integration.test.ts:66:30
     64|       const result = await runClaudeUpdate(sandbox, logger);
     65| 
     66|       expect(result.success).toBe(true);

Root Cause Analysis

The test creates a real E2B sandbox and runs claude update command, expecting it to succeed. The command is returning a non-zero exit code.

Potential causes:

  1. Claude CLI not properly installed/available in the E2B sandbox template
  2. The claude update command failing due to permission issues (npm global install)
  3. Network issues in the sandbox environment
  4. The E2B template (anthropic-claude-code) may have changed

Relevant Code

// src/e2b/claude-runner.ts
export async function runClaudeUpdate(
  sandbox: Sandbox,
  logger: Logger,
  authMethod: 'api-key' | 'oauth' = 'api-key'
): Promise<ClaudeUpdateResult> {
  // ... runs 'claude update' command
  const result = await sandbox.commands.run(updateCommand, {
    timeoutMs: CLAUDE_UPDATE_TIMEOUT_MS
  });
  const success = result.exitCode === 0;
  // ...
}

Proposed Fix Options

  1. Skip update if already at latest: Check Claude version first, skip update if already current
  2. Handle update failure gracefully: Mark test as skipped/warning if update fails due to known E2B limitations
  3. Use specific version check: Instead of running update, verify Claude is installed and accessible
  4. Update sandbox template expectations: Adjust test expectations based on actual sandbox behavior

Reproduction

E2B_API_KEY=your-key npm test -- tests/e2b/claude-runner-integration.test.ts -t "update Claude" --run

Labels

  • bug
  • component-e2b
  • component-tests
  • priority-medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomponent-e2bE2B sandbox integrationcomponent-testsTest suite improvementspriority-mediumMedium priority - next milestone

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions