(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestGeminiEngineInstallation(t *testing.T) { |
| 75 | engine := NewGeminiEngine() |
| 76 | |
| 77 | t.Run("standard installation", func(t *testing.T) { |
| 78 | workflowData := &WorkflowData{ |
| 79 | Name: "test-workflow", |
| 80 | } |
| 81 | |
| 82 | steps := engine.GetInstallationSteps(workflowData) |
| 83 | require.NotEmpty(t, steps, "Should generate installation steps") |
| 84 | |
| 85 | // Should have at least: Node.js setup + Install Gemini |
| 86 | // (secret validation is now in the activation job via GetSecretValidationStep) |
| 87 | assert.GreaterOrEqual(t, len(steps), 2, "Should have at least 2 installation steps") |
| 88 | |
| 89 | // Verify first step is Node.js setup |
| 90 | if len(steps) > 0 && len(steps[0]) > 0 { |
| 91 | stepContent := strings.Join(steps[0], "\n") |
| 92 | assert.Contains(t, stepContent, "Setup Node.js", "First step should setup Node.js") |
| 93 | } |
| 94 | |
| 95 | // Verify second step is Install Gemini CLI |
| 96 | if len(steps) > 1 && len(steps[1]) > 0 { |
| 97 | stepContent := strings.Join(steps[1], "\n") |
| 98 | assert.Contains(t, stepContent, "Install Gemini CLI", "Second step should install Gemini CLI") |
| 99 | assert.Contains(t, stepContent, "@google/gemini-cli", "Should install @google/gemini-cli package") |
| 100 | assert.NotContains(t, stepContent, "NPM_CONFIG_MIN_RELEASE_AGE", "Gemini installation should not set npm release-age cooldown") |
| 101 | } |
| 102 | }) |
| 103 | |
| 104 | t.Run("custom command skips installation", func(t *testing.T) { |
| 105 | workflowData := &WorkflowData{ |
| 106 | Name: "test-workflow", |
| 107 | EngineConfig: &EngineConfig{ |
| 108 | Command: "/custom/gemini", |
| 109 | }, |
| 110 | } |
| 111 | |
| 112 | steps := engine.GetInstallationSteps(workflowData) |
| 113 | assert.Empty(t, steps, "Should skip installation when custom command is specified") |
| 114 | }) |
| 115 | |
| 116 | t.Run("with firewall", func(t *testing.T) { |
| 117 | workflowData := &WorkflowData{ |
| 118 | Name: "test-workflow", |
| 119 | NetworkPermissions: &NetworkPermissions{ |
| 120 | Allowed: []string{"defaults"}, |
| 121 | Firewall: &FirewallConfig{ |
| 122 | Enabled: true, |
| 123 | }, |
| 124 | }, |
| 125 | } |
| 126 | |
| 127 | steps := engine.GetInstallationSteps(workflowData) |
| 128 | require.NotEmpty(t, steps, "Should generate installation steps") |
| 129 | |
| 130 | // Should include AWF installation step |
| 131 | hasAWFInstall := false |
nothing calls this directly
no test coverage detected