mirror of
https://github.com/git-pkgs/proxy.git
synced 2026-08-23 12:24:57 -04:00
* Refactor LoadFromEnv to use helpers Avoid triggering the linter about the cyclomatic complexity of the LoadFromEnv function in later changes by refactoring it to use setEnvString/setEnvBool helpers. No functional change, just collapse ~29 repetitive if-blocks into single-line calls to two small helpers. * Make Debian upstream repository configurable Support overriding the Debian handler's upstream (e.g. Ubuntu archives) via PROXY_UPSTREAM_DEBIAN or upstream.debian in the config file. Tested with PROXY_UPSTREAM_DEBIAN=http://archive.ubuntu.com/ubuntu to get Ubuntu Resolute packages.
23 lines
815 B
Go
23 lines
815 B
Go
package handler
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestDebianHandler_parsePoolPath(t *testing.T) {
|
|
h := &DebianHandler{}
|
|
|
|
assertPathParser(t, "parsePoolPath", h.parsePoolPath, []pathParseCase{
|
|
{"pool/main/n/nginx/nginx_1.18.0-6_amd64.deb", "nginx", "1.18.0-6", "amd64"},
|
|
{"pool/main/libn/libncurses/libncurses6_6.2-1_amd64.deb", "libncurses6", "6.2-1", "amd64"},
|
|
{"pool/contrib/v/virtualbox/virtualbox_6.1.38-1_amd64.deb", "virtualbox", "6.1.38-1", "amd64"},
|
|
{"pool/main/g/git/git_2.39.2-1_arm64.deb", "git", "2.39.2-1", "arm64"},
|
|
{"invalid/path", "", "", ""},
|
|
{"pool/main/n/nginx/nginx.deb", "", "", ""},
|
|
})
|
|
}
|
|
|
|
func TestDebianHandler_Routes(t *testing.T) {
|
|
h := NewDebianHandler(nil, "http://localhost:8080", "")
|
|
assertRoutesBasics(t, h.Routes(), "/dists/stable/Release", "/pool/../../../etc/passwd")
|
|
}
|