detached a159f47

Fix proxy tests on Windows

commit
a159f476ed3b182ce2fa95251dbc4300e185087a
author
patriceckhart · · 2026-08-06 06:08 UTC
parent
43baf04
signature
unsigned
refs
tag: v0.3.35
1 file · +27 -6
M packages/agent/config_proxy_test.go +27 -6
@@ -24,12 +24,14 @@ func TestApplyConfiguredHTTPProxy(t *testing.T) {
2424 }
2525 }
2626
27-func TestApplyConfiguredHTTPProxyPreservesEnvironment(t *testing.T) {
27+func TestApplyConfiguredHTTPProxyPreservesUppercaseEnvironment(t *testing.T) {
2828 t.Setenv("ZOT_HOME", t.TempDir())
29- t.Setenv("HTTP_PROXY", "http://http-env.example:8080")
29+ // Set lowercase first because environment variable names are
30+ // case-insensitive on Windows.
3031 t.Setenv("http_proxy", "")
31- t.Setenv("HTTPS_PROXY", "")
32- t.Setenv("https_proxy", "http://https-env.example:8080")
32+ t.Setenv("https_proxy", "")
33+ t.Setenv("HTTP_PROXY", "http://http-env.example:8080")
34+ t.Setenv("HTTPS_PROXY", "http://https-env.example:8080")
3335 if err := SaveConfig(Config{HTTPProxy: "http://config.example:8080"}); err != nil {
3436 t.Fatal(err)
3537 }
@@ -39,8 +41,27 @@ func TestApplyConfiguredHTTPProxyPreservesEnvironment(t *testing.T) {
3941 if got := getenvForTest("HTTP_PROXY"); got != "http://http-env.example:8080" {
4042 t.Fatalf("HTTP_PROXY = %q", got)
4143 }
42- if got := getenvForTest("HTTPS_PROXY"); got != "" {
43- t.Fatalf("HTTPS_PROXY = %q, want empty because lowercase environment setting takes precedence", got)
44+ if got := getenvForTest("HTTPS_PROXY"); got != "http://https-env.example:8080" {
45+ t.Fatalf("HTTPS_PROXY = %q", got)
46+ }
47+}
48+
49+func TestApplyConfiguredHTTPProxyPreservesLowercaseEnvironment(t *testing.T) {
50+ t.Setenv("ZOT_HOME", t.TempDir())
51+ // Set uppercase first because environment variable names are
52+ // case-insensitive on Windows.
53+ t.Setenv("HTTP_PROXY", "")
54+ t.Setenv("HTTPS_PROXY", "")
55+ t.Setenv("http_proxy", "http://http-env.example:8080")
56+ t.Setenv("https_proxy", "http://https-env.example:8080")
57+ if err := SaveConfig(Config{HTTPProxy: "http://config.example:8080"}); err != nil {
58+ t.Fatal(err)
59+ }
60+
61+ applyConfiguredHTTPProxy()
62+
63+ if got := getenvForTest("http_proxy"); got != "http://http-env.example:8080" {
64+ t.Fatalf("http_proxy = %q", got)
4465 }
4566 if got := getenvForTest("https_proxy"); got != "http://https-env.example:8080" {
4667 t.Fatalf("https_proxy = %q", got)
@@ -24,12 +24,14 @@ func TestApplyConfiguredHTTPProxy(t *testing.T) {
24 }24 }
25 }25 }
26 26
27-func TestApplyConfiguredHTTPProxyPreservesEnvironment(t *testing.T) {27+func TestApplyConfiguredHTTPProxyPreservesUppercaseEnvironment(t *testing.T) {
28 t.Setenv("ZOT_HOME", t.TempDir())28 t.Setenv("ZOT_HOME", t.TempDir())
29- t.Setenv("HTTP_PROXY", "http://http-env.example:8080")29+ // Set lowercase first because environment variable names are
30+ // case-insensitive on Windows.
30 t.Setenv("http_proxy", "")31 t.Setenv("http_proxy", "")
31- t.Setenv("HTTPS_PROXY", "")32+ t.Setenv("https_proxy", "")
32- t.Setenv("https_proxy", "http://https-env.example:8080")33+ t.Setenv("HTTP_PROXY", "http://http-env.example:8080")
34+ t.Setenv("HTTPS_PROXY", "http://https-env.example:8080")
33 if err := SaveConfig(Config{HTTPProxy: "http://config.example:8080"}); err != nil {35 if err := SaveConfig(Config{HTTPProxy: "http://config.example:8080"}); err != nil {
34 t.Fatal(err)36 t.Fatal(err)
35 }37 }
@@ -39,8 +41,27 @@ func TestApplyConfiguredHTTPProxyPreservesEnvironment(t *testing.T) {
39 if got := getenvForTest("HTTP_PROXY"); got != "http://http-env.example:8080" {41 if got := getenvForTest("HTTP_PROXY"); got != "http://http-env.example:8080" {
40 t.Fatalf("HTTP_PROXY = %q", got)42 t.Fatalf("HTTP_PROXY = %q", got)
41 }43 }
42- if got := getenvForTest("HTTPS_PROXY"); got != "" {44+ if got := getenvForTest("HTTPS_PROXY"); got != "http://https-env.example:8080" {
43- t.Fatalf("HTTPS_PROXY = %q, want empty because lowercase environment setting takes precedence", got)45+ t.Fatalf("HTTPS_PROXY = %q", got)
46+ }
47+}
48+
49+func TestApplyConfiguredHTTPProxyPreservesLowercaseEnvironment(t *testing.T) {
50+ t.Setenv("ZOT_HOME", t.TempDir())
51+ // Set uppercase first because environment variable names are
52+ // case-insensitive on Windows.
53+ t.Setenv("HTTP_PROXY", "")
54+ t.Setenv("HTTPS_PROXY", "")
55+ t.Setenv("http_proxy", "http://http-env.example:8080")
56+ t.Setenv("https_proxy", "http://https-env.example:8080")
57+ if err := SaveConfig(Config{HTTPProxy: "http://config.example:8080"}); err != nil {
58+ t.Fatal(err)
59+ }
60+
61+ applyConfiguredHTTPProxy()
62+
63+ if got := getenvForTest("http_proxy"); got != "http://http-env.example:8080" {
64+ t.Fatalf("http_proxy = %q", got)
44 }65 }
45 if got := getenvForTest("https_proxy"); got != "http://https-env.example:8080" {66 if got := getenvForTest("https_proxy"); got != "http://https-env.example:8080" {
46 t.Fatalf("https_proxy = %q", got)67 t.Fatalf("https_proxy = %q", got)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close