MCPcopy Create free account
hub / github.com/github/gh-aw / TestAntigravityEngineInstallation

Function TestAntigravityEngineInstallation

pkg/workflow/antigravity_engine_test.go:74–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestAntigravityEngineInstallation(t *testing.T) {
75 engine := NewAntigravityEngine()
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 exactly 1 step: Install Antigravity CLI
86 // (no Node.js setup needed; agy is a GCS binary, not an npm package)
87 assert.GreaterOrEqual(t, len(steps), 1, "Should have at least 1 installation step")
88
89 // Verify first step is Install Antigravity CLI
90 if len(steps) > 0 && len(steps[0]) > 0 {
91 stepContent := strings.Join(steps[0], "\n")
92 assert.Contains(t, stepContent, "Install Antigravity CLI", "First step should install Antigravity CLI")
93 assert.Contains(t, stepContent, "install_antigravity_cli.sh", "Should use the Antigravity CLI install script")
94 assert.Contains(t, stepContent, `"${ENGINE_VERSION}"`, "Should pass version via ENGINE_VERSION env var")
95 assert.NotContains(t, stepContent, "NPM_CONFIG_MIN_RELEASE_AGE", "Antigravity installation should not set npm release-age cooldown")
96 }
97 })
98
99 t.Run("custom command skips installation", func(t *testing.T) {
100 workflowData := &WorkflowData{
101 Name: "test-workflow",
102 EngineConfig: &EngineConfig{
103 Command: "/custom/antigravity",
104 },
105 }
106
107 steps := engine.GetInstallationSteps(workflowData)
108 assert.Empty(t, steps, "Should skip installation when custom command is specified")
109 })
110
111 t.Run("with firewall", func(t *testing.T) {
112 workflowData := &WorkflowData{
113 Name: "test-workflow",
114 NetworkPermissions: &NetworkPermissions{
115 Allowed: []string{"defaults"},
116 Firewall: &FirewallConfig{
117 Enabled: true,
118 },
119 },
120 }
121
122 steps := engine.GetInstallationSteps(workflowData)
123 require.NotEmpty(t, steps, "Should generate installation steps")
124
125 // Should include AWF installation step
126 hasAWFInstall := false
127 for _, step := range steps {
128 stepContent := strings.Join(step, "\n")
129 if strings.Contains(stepContent, "awf") || strings.Contains(stepContent, "firewall") {
130 hasAWFInstall = true
131 break

Callers

nothing calls this directly

Calls 3

GetInstallationStepsMethod · 0.95
NewAntigravityEngineFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected