(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestGeminiEngine(t *testing.T) { |
| 14 | engine := NewGeminiEngine() |
| 15 | |
| 16 | t.Run("engine identity", func(t *testing.T) { |
| 17 | assert.Equal(t, "gemini", engine.GetID(), "Engine ID should be 'gemini'") |
| 18 | assert.Equal(t, "Google Gemini CLI", engine.GetDisplayName(), "Display name should be 'Google Gemini CLI'") |
| 19 | assert.NotEmpty(t, engine.GetDescription(), "Description should not be empty") |
| 20 | assert.False(t, engine.IsExperimental(), "Gemini engine should not be experimental") |
| 21 | }) |
| 22 | |
| 23 | t.Run("capabilities", func(t *testing.T) { |
| 24 | capabilities := engine.GetCapabilities() |
| 25 | assert.True(t, capabilities.ToolsAllowlist, "Should support tools allowlist") |
| 26 | assert.True(t, capabilities.MaxTurns, "Should support max turns") |
| 27 | assert.False(t, capabilities.WebSearch, "Should not support built-in web search") |
| 28 | }) |
| 29 | |
| 30 | t.Run("required secrets", func(t *testing.T) { |
| 31 | workflowData := &WorkflowData{ |
| 32 | Name: "test", |
| 33 | ParsedTools: &ToolsConfig{}, |
| 34 | Tools: map[string]any{}, |
| 35 | } |
| 36 | secrets := engine.GetRequiredSecretNames(workflowData) |
| 37 | assert.Contains(t, secrets, "GEMINI_API_KEY", "Should require GEMINI_API_KEY") |
| 38 | }) |
| 39 | |
| 40 | t.Run("required secrets with MCP servers", func(t *testing.T) { |
| 41 | workflowData := &WorkflowData{ |
| 42 | Name: "test", |
| 43 | ParsedTools: &ToolsConfig{ |
| 44 | GitHub: &GitHubToolConfig{}, |
| 45 | }, |
| 46 | Tools: map[string]any{ |
| 47 | "github": map[string]any{}, |
| 48 | }, |
| 49 | } |
| 50 | secrets := engine.GetRequiredSecretNames(workflowData) |
| 51 | assert.Contains(t, secrets, "GEMINI_API_KEY", "Should require GEMINI_API_KEY") |
| 52 | assert.Contains(t, secrets, "MCP_GATEWAY_API_KEY", "Should require MCP_GATEWAY_API_KEY when MCP servers present") |
| 53 | assert.Contains(t, secrets, "GITHUB_MCP_SERVER_TOKEN", "Should require GITHUB_MCP_SERVER_TOKEN for GitHub tool") |
| 54 | }) |
| 55 | |
| 56 | t.Run("declared output files", func(t *testing.T) { |
| 57 | outputFiles := engine.GetDeclaredOutputFiles() |
| 58 | require.Len(t, outputFiles, 1, "Should declare one output file path") |
| 59 | assert.Equal(t, "/tmp/gh-aw/gemini-client-error-*.json", outputFiles[0], "Should declare Gemini error log wildcard path under /tmp/gh-aw/") |
| 60 | }) |
| 61 | |
| 62 | t.Run("pre-bundle steps move files to /tmp/gh-aw/", func(t *testing.T) { |
| 63 | workflowData := &WorkflowData{Name: "test-workflow"} |
| 64 | steps := engine.GetPreBundleSteps(workflowData) |
| 65 | require.Len(t, steps, 1, "Should return exactly one pre-bundle step") |
| 66 | |
| 67 | stepContent := strings.Join(steps[0], "\n") |
| 68 | assert.Contains(t, stepContent, "Move Gemini error files", "Step name should describe move operation") |
| 69 | assert.Contains(t, stepContent, "mv /tmp/gemini-client-error-*.json /tmp/gh-aw/", "Step should move files to /tmp/gh-aw/") |
| 70 | assert.Contains(t, stepContent, "if: always()", "Step should run always so files are captured on failure") |
nothing calls this directly
no test coverage detected