@@ -18,80 +18,81 @@ func TestGenerateSystemdFiles(t *testing.T) {
18
18
vars HTTPProxyVariables
19
19
noProxy []string
20
20
expectedContents string
21
- }{{
22
- name : "no proxy configuration" ,
23
- }, {
24
- name : "all vars set" ,
25
- vars : HTTPProxyVariables {
26
- HTTP : "http://example.com" ,
27
- HTTPS : "https://example.com" ,
28
- AdditionalNO : []string {
29
- "https://no-proxy.example.com" ,
21
+ }{
22
+ {
23
+ name : "no proxy configuration" ,
24
+ }, {
25
+ name : "all vars set" ,
26
+ vars : HTTPProxyVariables {
27
+ HTTP : "http://example.com" ,
28
+ HTTPS : "https://example.com" ,
29
+ AdditionalNO : []string {
30
+ "https://no-proxy.example.com" ,
31
+ },
30
32
},
31
- },
32
- expectedContents : `[Service]
33
+ expectedContents : `[Service]
33
34
Environment="HTTP_PROXY=http://example.com"
34
35
Environment="http_proxy=http://example.com"
35
36
Environment="HTTPS_PROXY=https://example.com"
36
37
Environment="https_proxy=https://example.com"
37
38
Environment="NO_PROXY=https://no-proxy.example.com"
38
39
Environment="no_proxy=https://no-proxy.example.com"
39
40
` ,
40
- }, {
41
- name : "http only" ,
42
- vars : HTTPProxyVariables {
43
- HTTP : "http://example.com" ,
44
- },
45
- expectedContents : `[Service]
41
+ }, {
42
+ name : "http only" ,
43
+ vars : HTTPProxyVariables {
44
+ HTTP : "http://example.com" ,
45
+ },
46
+ expectedContents : `[Service]
46
47
Environment="HTTP_PROXY=http://example.com"
47
48
Environment="http_proxy=http://example.com"
48
49
` ,
49
- }, {
50
- name : "https only" ,
51
- vars : HTTPProxyVariables {
52
- HTTPS : "https://example.com" ,
53
- },
54
- expectedContents : `[Service]
50
+ }, {
51
+ name : "https only" ,
52
+ vars : HTTPProxyVariables {
53
+ HTTPS : "https://example.com" ,
54
+ },
55
+ expectedContents : `[Service]
55
56
Environment="HTTPS_PROXY=https://example.com"
56
57
Environment="https_proxy=https://example.com"
57
58
` ,
58
- }, {
59
- name : "no proxy only" ,
60
- vars : HTTPProxyVariables {
61
- AdditionalNO : []string {
62
- "https://no-proxy.example.com" ,
59
+ }, {
60
+ name : "no proxy only" ,
61
+ vars : HTTPProxyVariables {
62
+ AdditionalNO : []string {
63
+ "https://no-proxy.example.com" ,
64
+ },
63
65
},
64
- },
65
- expectedContents : `[Service]
66
+ expectedContents : `[Service]
66
67
Environment="NO_PROXY=https://no-proxy.example.com"
67
68
Environment="no_proxy=https://no-proxy.example.com"
68
69
` ,
69
- }, {
70
- name : "multiple no proxy only" ,
71
- vars : HTTPProxyVariables {
72
- AdditionalNO : []string {
73
- "https://no-proxy.example.com" ,
74
- "https://no-proxy-1.example.com" ,
70
+ }, {
71
+ name : "multiple no proxy only" ,
72
+ vars : HTTPProxyVariables {
73
+ AdditionalNO : []string {
74
+ "https://no-proxy.example.com" ,
75
+ "https://no-proxy-1.example.com" ,
76
+ },
75
77
},
76
- },
77
- expectedContents : `[Service]
78
+ expectedContents : `[Service]
78
79
Environment="NO_PROXY=https://no-proxy.example.com,https://no-proxy-1.example.com"
79
80
Environment="no_proxy=https://no-proxy.example.com,https://no-proxy-1.example.com"
80
81
` ,
81
- }, {
82
- name : "default no proxy values" ,
83
- vars : HTTPProxyVariables {
84
- AdditionalNO : []string {
85
- "https://no-proxy.example.com" ,
86
- "https://no-proxy-1.example.com" ,
82
+ }, {
83
+ name : "default no proxy values" ,
84
+ vars : HTTPProxyVariables {
85
+ AdditionalNO : []string {
86
+ "https://no-proxy.example.com" ,
87
+ "https://no-proxy-1.example.com" ,
88
+ },
87
89
},
88
- },
89
- noProxy : []string {"localhost" , "127.0.0.1" },
90
- expectedContents : `[Service]
90
+ noProxy : []string {"localhost" , "127.0.0.1" },
91
+ expectedContents : `[Service]
91
92
Environment="NO_PROXY=localhost,127.0.0.1,https://no-proxy.example.com,https://no-proxy-1.example.com"
92
93
Environment="no_proxy=localhost,127.0.0.1,https://no-proxy.example.com,https://no-proxy-1.example.com"
93
94
` ,
94
- },
95
+ },
95
96
}
96
97
97
98
for idx := range tests {
0 commit comments