@@ -7,22 +7,21 @@ import (
7
7
8
8
s2iapi "github.com/openshift/source-to-image/pkg/api"
9
9
10
- "k8s.io/api/core/v1"
11
- kapi "k8s.io/kubernetes/pkg/api"
10
+ corev1 "k8s.io/api/core/v1"
12
11
13
- buildapi "github.com/openshift/origin/pkg/ build/apis/build "
12
+ buildapiv1 "github.com/openshift/api/ build/v1 "
14
13
)
15
14
16
15
func TestTrustedMergeEnvWithoutDuplicates (t * testing.T ) {
17
- input := []v1 .EnvVar {
16
+ input := []corev1 .EnvVar {
18
17
// stripped by whitelist
19
18
{Name : "foo" , Value : "bar" },
20
19
// stripped by whitelist
21
20
{Name : "input" , Value : "inputVal" },
22
21
{Name : "GIT_SSL_NO_VERIFY" , Value : "source" },
23
22
{Name : "BUILD_LOGLEVEL" , Value : "source" },
24
23
}
25
- output := []v1 .EnvVar {
24
+ output := []corev1 .EnvVar {
26
25
{Name : "foo" , Value : "test" },
27
26
{Name : "GIT_SSL_NO_VERIFY" , Value : "target" },
28
27
}
@@ -52,15 +51,15 @@ func TestTrustedMergeEnvWithoutDuplicates(t *testing.T) {
52
51
t .Errorf ("Expected output env 'BUILD_LOGLEVEL' to have value 'loglevel', got %+v" , output [1 ])
53
52
}
54
53
55
- input = []v1 .EnvVar {
54
+ input = []corev1 .EnvVar {
56
55
// stripped by whitelist
57
56
{Name : "foo" , Value : "bar" },
58
57
// stripped by whitelist
59
58
{Name : "input" , Value : "inputVal" },
60
59
{Name : "GIT_SSL_NO_VERIFY" , Value : "source" },
61
60
{Name : "BUILD_LOGLEVEL" , Value : "source" },
62
61
}
63
- output = []v1 .EnvVar {
62
+ output = []corev1 .EnvVar {
64
63
{Name : "foo" , Value : "test" },
65
64
{Name : "GIT_SSL_NO_VERIFY" , Value : "target" },
66
65
}
@@ -200,20 +199,20 @@ func checkEnvList(t *testing.T, envs s2iapi.EnvironmentList, orig bool) {
200
199
func TestSafeForLoggingBuild (t * testing.T ) {
201
200
httpProxy := "http://user:[email protected] "
202
201
httpsProxy := "https://user:[email protected] "
203
- proxyBuild := & buildapi .Build {
204
- Spec : buildapi .BuildSpec {
205
- CommonSpec : buildapi .CommonSpec {
206
- Source : buildapi .BuildSource {
207
- Git : & buildapi .GitBuildSource {
208
- ProxyConfig : buildapi .ProxyConfig {
202
+ proxyBuild := & buildapiv1 .Build {
203
+ Spec : buildapiv1 .BuildSpec {
204
+ CommonSpec : buildapiv1 .CommonSpec {
205
+ Source : buildapiv1 .BuildSource {
206
+ Git : & buildapiv1 .GitBuildSource {
207
+ ProxyConfig : buildapiv1 .ProxyConfig {
209
208
HTTPProxy : & httpProxy ,
210
209
HTTPSProxy : & httpsProxy ,
211
210
},
212
211
},
213
212
},
214
- Strategy : buildapi .BuildStrategy {
215
- SourceStrategy : & buildapi .SourceBuildStrategy {
216
- Env : []kapi .EnvVar {
213
+ Strategy : buildapiv1 .BuildStrategy {
214
+ SourceStrategy : & buildapiv1 .SourceBuildStrategy {
215
+ Env : []corev1 .EnvVar {
217
216
{
218
217
Name : "HTTP_PROXY" ,
219
218
Value :
"http://user:[email protected] " ,
@@ -228,8 +227,8 @@ func TestSafeForLoggingBuild(t *testing.T) {
228
227
},
229
228
},
230
229
},
231
- DockerStrategy : & buildapi .DockerBuildStrategy {
232
- Env : []kapi .EnvVar {
230
+ DockerStrategy : & buildapiv1 .DockerBuildStrategy {
231
+ Env : []corev1 .EnvVar {
233
232
{
234
233
Name : "HTTP_PROXY" ,
235
234
Value :
"http://user:[email protected] " ,
@@ -244,8 +243,8 @@ func TestSafeForLoggingBuild(t *testing.T) {
244
243
},
245
244
},
246
245
},
247
- CustomStrategy : & buildapi .CustomBuildStrategy {
248
- Env : []kapi .EnvVar {
246
+ CustomStrategy : & buildapiv1 .CustomBuildStrategy {
247
+ Env : []corev1 .EnvVar {
249
248
{
250
249
Name : "HTTP_PROXY" ,
251
250
Value :
"http://user:[email protected] " ,
@@ -260,8 +259,8 @@ func TestSafeForLoggingBuild(t *testing.T) {
260
259
},
261
260
},
262
261
},
263
- JenkinsPipelineStrategy : & buildapi .JenkinsPipelineBuildStrategy {
264
- Env : []kapi .EnvVar {
262
+ JenkinsPipelineStrategy : & buildapiv1 .JenkinsPipelineBuildStrategy {
263
+ Env : []corev1 .EnvVar {
265
264
{
266
265
Name : "HTTP_PROXY" ,
267
266
Value :
"http://user:[email protected] " ,
@@ -294,7 +293,7 @@ func TestSafeForLoggingBuild(t *testing.T) {
294
293
checkEnv (t , stripped .Spec .Strategy .JenkinsPipelineStrategy .Env )
295
294
}
296
295
297
- func checkEnv (t * testing.T , envs []kapi .EnvVar ) {
296
+ func checkEnv (t * testing.T , envs []corev1 .EnvVar ) {
298
297
for _ , env := range envs {
299
298
if env .Name == "other_value" {
300
299
if ! credsRegex .MatchString (env .Value ) {
0 commit comments