main / internal/web/push_test.go · 684 bytes · raw
package web
import (
"crypto/rand"
"os"
"path/filepath"
"testing"
)
func TestLargePush(t *testing.T) {
httpServer, _, _ := newTestServer(t)
owner := noFollow(newLoggedInClient(t, httpServer))
createRepo(t, owner, httpServer, "big", "public")
work := cloneRepo(t, httpServer, "big")
blob := make([]byte, 16<<20)
if _, err := rand.Read(blob); err != nil {
t.Fatalf("rand: %v", err)
}
if err := os.WriteFile(filepath.Join(work, "blob.bin"), blob, 0o644); err != nil {
t.Fatalf("write blob: %v", err)
}
runGit(t, work, "add", ".")
runGit(t, work, "commit", "-qm", "big")
runGit(t, work, "-c", "credential.helper=", "push", "-q", "origin", "HEAD:refs/heads/main")
}