feat(infra/git): clone/fetch/push/commit/status verbs + integration tests

This commit is contained in:
2026-05-01 21:43:56 +08:00
parent f8c7771892
commit faecb05ebd
10 changed files with 280 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package git
import (
"context"
"path/filepath"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestClone_Success(t *testing.T) {
t.Parallel()
gitAvailable(t)
bare := makeBareRepo(t)
r := newTestRunner(t)
dst := filepath.Join(t.TempDir(), "wc")
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
require.NoError(t, r.Clone(ctx, dst, bare, "main", nil))
require.FileExists(t, filepath.Join(dst, "README.md"))
}
func TestClone_BadURL(t *testing.T) {
t.Parallel()
gitAvailable(t)
r := newTestRunner(t)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
err := r.Clone(ctx, filepath.Join(t.TempDir(), "x"), "/no/such/path/repo.git", "main", nil)
require.Error(t, err)
}