Compare commits

..

1 Commits

Author SHA1 Message Date
706d539dc4
WIP: feat: cancel git clone ops gracefully
Some checks reported errors
continuous-integration/drone/push Build was killed
See #528
2025-04-22 18:43:48 +02:00

View File

@ -1,9 +1,36 @@
package git
import (
"fmt"
"os"
"path"
"syscall"
"testing"
"time"
"coopcloud.tech/abra/pkg/config"
)
func TestCancelGitClone(t *testing.T) {
// TODO
go func() {
time.Sleep(time.Second * 1)
p, err := os.FindProcess(os.Getpid())
if err != nil {
t.Fatalf("unable to find current process: %s", err)
}
p.Signal(syscall.SIGINT)
}()
gitURL := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, "gitea")
dir := path.Join(config.RECIPES_DIR, "gitea")
if err := Clone(dir, gitURL); err == nil {
t.Fatal("cloning should have been interrupted")
}
if _, err := os.Stat(dir); !os.IsNotExist(err) {
t.Fatal("recipe directory should have been deleted")
}
}