feat: funciones infra — Docker, deploy, build y health check
Funciones impuras para gestión de contenedores: docker_build_image, docker_compose_up/down, docker_volume_create/list/remove, generate_dockerfile, write_dockerfile, go_build_binary, health_check_http, deploy_app y stop_app. Todas con tests unitarios donde aplica. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package infra
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDockerVolumeRemove(t *testing.T) {
|
||||
t.Run("error si volume no existe", func(t *testing.T) {
|
||||
err := DockerVolumeRemove("fn-registry-vol-que-no-existe-xyz", false)
|
||||
if err == nil {
|
||||
t.Error("se esperaba error para volume inexistente")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("force flag incluye -f en el comando", func(t *testing.T) {
|
||||
name := "fn-registry-test-vol-remove"
|
||||
_, err := DockerVolumeCreate(name)
|
||||
if err != nil {
|
||||
t.Skipf("docker no disponible: %v", err)
|
||||
}
|
||||
|
||||
err = DockerVolumeRemove(name, true)
|
||||
if err != nil {
|
||||
t.Errorf("DockerVolumeRemove con force: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user