MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestIntegrateCmd_RunE_Remove_E2E

Function TestIntegrateCmd_RunE_Remove_E2E

cmds/cmd_integrate_test.go:164–199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestIntegrateCmd_RunE_Remove_E2E(t *testing.T) {
165 if runtime.GOOS != "windows" {
166 if _, err := os.Stat("/bin/bash"); err != nil {
167 t.Skip("no usable bash on this host")
168 }
169 }
170
171 // Register first (sets up the same temp home dir that --remove will tear down).
172 homeDir := t.TempDir()
173 if runtime.GOOS == "windows" {
174 t.Setenv("USERPROFILE", homeDir)
175 } else {
176 t.Setenv("HOME", homeDir)
177 t.Setenv("SHELL", "/bin/bash")
178 if err := os.WriteFile(filepath.Join(homeDir, ".bashrc"), nil, 0o644); err != nil {
179 t.Fatal(err)
180 }
181 }
182
183 register := &integrateCmd{}
184 if _, err := runCommand(t, register.Command(configs.NewCeler())); err != nil {
185 t.Fatalf("register should succeed: %v", err)
186 }
187
188 remove := &integrateCmd{}
189 if _, err := runCommand(t, remove.Command(configs.NewCeler()), "--remove"); err != nil {
190 t.Fatalf("--remove should succeed: %v", err)
191 }
192
193 // After --remove, the binary and completion file should be gone.
194 for _, path := range integrateArtifacts(homeDir) {
195 if fileio.PathExists(path) {
196 t.Errorf("integrate --remove should delete %s", path)
197 }
198 }
199}
200
201func TestIntegrateCmd_DetectShell_PanicSafe(t *testing.T) {
202 // Cleanup.

Callers

nothing calls this directly

Calls 6

CommandMethod · 0.95
NewCelerFunction · 0.92
PathExistsFunction · 0.92
runCommandFunction · 0.85
integrateArtifactsFunction · 0.85
WriteFileMethod · 0.80

Tested by

no test coverage detected