test: add comprehensive E2E tests for git clone/fetch operations and … - #33
Conversation
…upload-pack handlers Agregado archivo e2e_test.go con helpers gitCmd(), requireGit(), mockGitHubUploadPack() y mustGitInit() para simular repositorios Git reales. Implementados tests E2E: TestE2E_InfoRefs_UploadPack (verifica advertisement de git-upload-pack), TestE2E_GitClone (valida clone completo con mock de GitHub), TestE2E_GitFetch (prueba fetch desde repo clonado), TestE2E_InfoRefs_UnsupportedService (valida rechazo de servicios desconoc
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR adds Git upload-pack support to the HTTP proxy, enabling Git clone and fetch operations with GitHub authentication. It includes end-to-end tests, unit tests, new routes, and a comprehensive web UI redesign featuring theme support, markdown editor, and badge generator. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client (Git)
participant Router as Proxy Router
participant Handler as UploadPackHandler
participant Auth as Auth Logic
participant GitHub as GitHub API
participant Response as Git Stream Response
Client->>Router: POST /git-upload-pack<br/>(with upload-pack data)
Router->>Handler: Route to UploadPackHandler
Handler->>Auth: Check GITHUB_TOKEN
Auth-->>Handler: Token retrieved
Handler->>Handler: Set Authorization header<br/>(basicAuth)
Handler->>Handler: Enforce 50MB body limit
Handler->>GitHub: Forward request<br/>(with auth header)
GitHub-->>Handler: Git response data
Handler->>Response: Stream response back
Response-->>Client: Git pack data
Client->>Client: Process git objects
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a0cda9b5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gh.POST("/:owner/:repo/git-receive-pack", ReceivePackHandler) | ||
|
|
||
| // Git Smart HTTP - upload-pack (fetch/pull) | ||
| gh.POST("/:owner/:repo/git-upload-pack", UploadPackHandler) |
There was a problem hiding this comment.
Allow anonymous access to git-upload-pack
Registering /:owner/:repo/git-upload-pack inside the /v1 group makes it pass through anonymousAuthMiddleware, but that middleware only bypasses auth for git-receive-pack and info/refs. In deployments where GITGOST_API_KEY is set, every clone/fetch request will fail on the POST phase with 401 unless clients send X-Gitgost-Key, which standard Git clone/fetch flows do not send by default.
Useful? React with 👍 / 👎.
| "github.com/gin-gonic/gin" | ||
| ) | ||
|
|
||
| var uploadPackClient = &http.Client{Timeout: 30 * time.Second} |
There was a problem hiding this comment.
Remove hard 30s timeout from upload-pack proxying
Using a single http.Client{Timeout: 30 * time.Second} for upload-pack can terminate valid clone/fetch operations for large repos or slower networks, because this timeout applies to the entire upstream request/response transfer (including streaming the packfile body). That makes fetch reliability dependent on finishing within 30 seconds rather than on connection health.
Useful? React with 👍 / 👎.
…upload-pack handlers
Agregado archivo e2e_test.go con helpers gitCmd(), requireGit(), mockGitHubUploadPack() y mustGitInit() para simular repositorios Git reales. Implementados tests E2E: TestE2E_InfoRefs_UploadPack (verifica advertisement de git-upload-pack), TestE2E_GitClone (valida clone completo con mock de GitHub), TestE2E_GitFetch (prueba fetch desde repo clonado), TestE2E_InfoRefs_UnsupportedService (valida rechazo de servicios desconoc
Summary by CodeRabbit
New Features
UI/Style