Compare commits
1 Commits
20c1bf2c21
...
706d539dc4
Author | SHA1 | Date | |
---|---|---|---|
706d539dc4 |
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user