@@ -173,39 +173,48 @@ var _ = Describe("Factory#Daemonset", func() {
173
173
Fail (fmt .Sprintf ("Exp. collector to include env var: %s" , name ))
174
174
}
175
175
176
- It ("should add the proxy variables to the collector" , func () {
177
- _httpProxy := os .Getenv ("http_proxy" )
178
- _httpsProxy := os .Getenv ("https_proxy" )
179
- _noProxy := os .Getenv ("no_proxy" )
180
- cleanup := func () {
181
- _ = os .Setenv ("http_proxy" , _httpProxy )
182
- _ = os .Setenv ("https_proxy" , _httpsProxy )
183
- _ = os .Setenv ("no_proxy" , _noProxy )
184
- }
185
- defer cleanup ()
186
-
187
- httpproxy := "http://[email protected] /3128/"
188
- noproxy := ".cluster.local,localhost"
189
- _ = os .Setenv ("http_proxy" , httpproxy )
190
- _ = os .Setenv ("https_proxy" , httpproxy )
191
- _ = os .Setenv ("no_proxy" , noproxy )
192
- caBundle := "-----BEGIN CERTIFICATE-----\n <PEM_ENCODED_CERT>\n -----END CERTIFICATE-----\n "
193
- podSpec = * factory .NewPodSpec (& v1.ConfigMap {
194
- ObjectMeta : metav1.ObjectMeta {
195
- Namespace : "openshift-logging" ,
196
- Name : constants .CollectorTrustedCAName ,
197
- },
198
- Data : map [string ]string {
199
- constants .TrustedCABundleKey : caBundle ,
200
- },
201
- }, logging.ClusterLogForwarderSpec {}, "1234" , "" , tls .GetClusterTLSProfileSpec (nil ), nil , constants .OpenshiftNS )
202
- collector = podSpec .Containers [0 ]
176
+ DescribeTable ("should add the proxy variables to the collector" ,
177
+ func (collectorType logging.LogCollectionType , setHttpProxy , setHttpsProxy , setNoProxy , expectedHttpProxy , expectedHttpsProxy , expectedNoProxy string ) {
178
+ _httpProxy := os .Getenv (setHttpProxy )
179
+ _httpsProxy := os .Getenv (setHttpsProxy )
180
+ _noProxy := os .Getenv (setNoProxy )
181
+ cleanup := func () {
182
+ _ = os .Setenv (setHttpProxy , _httpProxy )
183
+ _ = os .Setenv (setHttpsProxy , _httpsProxy )
184
+ _ = os .Setenv (setNoProxy , _noProxy )
185
+ }
186
+ defer cleanup ()
187
+
188
+ httpproxy := "http://[email protected] /3128/"
189
+ noproxy := ".cluster.local,localhost"
190
+ _ = os .Setenv (setHttpProxy , httpproxy )
191
+ _ = os .Setenv (setHttpsProxy , httpproxy )
192
+ _ = os .Setenv (setNoProxy , noproxy )
193
+ caBundle := "-----BEGIN CERTIFICATE-----\n <PEM_ENCODED_CERT>\n -----END CERTIFICATE-----\n "
194
+ factory .CollectorSpec = logging.CollectionSpec {
195
+ Type : collectorType ,
196
+ }
197
+ podSpec = * factory .NewPodSpec (& v1.ConfigMap {
198
+ ObjectMeta : metav1.ObjectMeta {
199
+ Namespace : "openshift-logging" ,
200
+ Name : constants .CollectorTrustedCAName ,
201
+ },
202
+ Data : map [string ]string {
203
+ constants .TrustedCABundleKey : caBundle ,
204
+ },
205
+ }, logging.ClusterLogForwarderSpec {}, "1234" , "" , tls .GetClusterTLSProfileSpec (nil ), nil , constants .OpenshiftNS )
206
+ collector = podSpec .Containers [0 ]
203
207
204
- verifyEnvVar (collector , "http_proxy" , httpproxy )
205
- verifyEnvVar (collector , "https_proxy" , httpproxy )
206
- verifyEnvVar (collector , "no_proxy" , "elasticsearch," + noproxy )
207
- verifyProxyVolumesAndVolumeMounts (collector , podSpec , constants .CollectorTrustedCAName )
208
- })
208
+ verifyEnvVar (collector , expectedHttpProxy , httpproxy )
209
+ verifyEnvVar (collector , expectedHttpsProxy , httpproxy )
210
+ verifyEnvVar (collector , expectedNoProxy , "elasticsearch," + noproxy )
211
+ verifyProxyVolumesAndVolumeMounts (collector , podSpec , constants .CollectorTrustedCAName )
212
+ },
213
+ Entry ("Fluentd expect environment variable name in lowercase" , logging .LogCollectionTypeFluentd , "http_proxy" , "https_proxy" , "no_proxy" , "http_proxy" , "https_proxy" , "no_proxy" ),
214
+ Entry ("Fluentd expects existing uppercase environment variable values to be lowercased" , logging .LogCollectionTypeFluentd , "HTTP_PROXY" , "HTTPS_PROXY" , "NO_PROXY" , "http_proxy" , "https_proxy" , "no_proxy" ),
215
+ Entry ("Vector expect environment variable in uppercase" , logging .LogCollectionTypeVector , "HTTP_PROXY" , "HTTPS_PROXY" , "NO_PROXY" , "HTTP_PROXY" , "HTTPS_PROXY" , "NO_PROXY" ),
216
+ Entry ("Vector expects existing lowercase environment variable values to be uppercased" , logging .LogCollectionTypeVector , "http_proxy" , "https_proxy" , "no_proxy" , "HTTP_PROXY" , "HTTPS_PROXY" , "NO_PROXY" ),
217
+ )
209
218
})
210
219
211
220
Context ("and using custom named ClusterLogForwarder" , func () {
@@ -546,53 +555,6 @@ var _ = Describe("Factory#Deployment", func() {
546
555
547
556
})
548
557
549
- Context ("and the proxy config exists" , func () {
550
-
551
- var verifyEnvVar = func (container v1.Container , name , value string ) {
552
- for _ , elem := range container .Env {
553
- if elem .Name == name {
554
- Expect (elem .Value ).To (Equal (value ), "Exp. collector to have env var %s: %s:" , name , value )
555
- return
556
- }
557
- }
558
- Fail (fmt .Sprintf ("Exp. collector to include env var: %s" , name ))
559
- }
560
-
561
- It ("should add the proxy variables to the collector" , func () {
562
- _httpProxy := os .Getenv ("http_proxy" )
563
- _httpsProxy := os .Getenv ("https_proxy" )
564
- _noProxy := os .Getenv ("no_proxy" )
565
- cleanup := func () {
566
- _ = os .Setenv ("http_proxy" , _httpProxy )
567
- _ = os .Setenv ("https_proxy" , _httpsProxy )
568
- _ = os .Setenv ("no_proxy" , _noProxy )
569
- }
570
- defer cleanup ()
571
-
572
- httpproxy := "http://[email protected] /3128/"
573
- noproxy := ".cluster.local,localhost"
574
- _ = os .Setenv ("http_proxy" , httpproxy )
575
- _ = os .Setenv ("https_proxy" , httpproxy )
576
- _ = os .Setenv ("no_proxy" , noproxy )
577
- caBundle := "-----BEGIN CERTIFICATE-----\n <PEM_ENCODED_CERT>\n -----END CERTIFICATE-----\n "
578
- podSpec = * factory .NewPodSpec (& v1.ConfigMap {
579
- ObjectMeta : metav1.ObjectMeta {
580
- Namespace : "openshift-logging" ,
581
- Name : constants .CollectorTrustedCAName ,
582
- },
583
- Data : map [string ]string {
584
- constants .TrustedCABundleKey : caBundle ,
585
- },
586
- }, logging.ClusterLogForwarderSpec {}, "1234" , "" , tls .GetClusterTLSProfileSpec (nil ), nil , constants .OpenshiftNS )
587
- collector = podSpec .Containers [0 ]
588
-
589
- verifyEnvVar (collector , "http_proxy" , httpproxy )
590
- verifyEnvVar (collector , "https_proxy" , httpproxy )
591
- verifyEnvVar (collector , "no_proxy" , "elasticsearch," + noproxy )
592
- verifyProxyVolumesAndVolumeMounts (collector , podSpec , constants .CollectorTrustedCAName )
593
- })
594
- })
595
-
596
558
Context ("and using custom named ClusterLogForwarder" , func () {
597
559
598
560
It ("should have custom named podSpec resources based on CLF name" , func () {
0 commit comments