@@ -43,33 +43,7 @@ describe('Virtual Machine actions', function () {
43
43
} ,
44
44
] ,
45
45
} )
46
- nock ( process . env . CLUSTER_API_URL )
47
- . get ( '/apis/route.openshift.io/v1/namespaces/multicluster-engine/routes/cluster-proxy-addon-user' )
48
- . reply ( 200 , {
49
- kind : 'Route' ,
50
- apiVersion : 'route.openshift.io/v1' ,
51
- metadata : {
52
- name : 'cluster-proxy-addon-user' ,
53
- namespace : 'multicluster-engine' ,
54
- } ,
55
- spec : {
56
- host : 'testCluster.red-chesterfield.com' ,
57
- to : {
58
- kind : 'Service' ,
59
- name : 'cluster-proxy-addon-user' ,
60
- weight : 100 ,
61
- } ,
62
- port : {
63
- targetPort : 'user-port' ,
64
- } ,
65
- tls : {
66
- termination : 'reencrypt' ,
67
- insecureEdgeTerminationPolicy : 'Redirect' ,
68
- } ,
69
- wildcardPolicy : 'None' ,
70
- } ,
71
- } )
72
- nock ( 'https://testcluster.red-chesterfield.com' )
46
+ nock ( 'https://cluster-proxy-addon-user.multicluster-engine.svc.cluster.local:9092' )
73
47
. put ( '/testCluster/apis/subresources.kubevirt.io/v1/namespaces/vmNamespace/virtualmachines/vmName/start' )
74
48
. reply ( 200 , {
75
49
statusCode : 200 ,
@@ -116,50 +90,15 @@ describe('Virtual Machine actions', function () {
116
90
} ,
117
91
] ,
118
92
} )
119
- nock ( process . env . CLUSTER_API_URL )
120
- . get ( '/apis/route.openshift.io/v1/namespaces/multicluster-engine/routes/cluster-proxy-addon-user' )
121
- . reply ( 200 , {
122
- kind : 'Route' ,
123
- apiVersion : 'route.openshift.io/v1' ,
124
- metadata : {
125
- name : 'cluster-proxy-addon-user' ,
126
- namespace : 'multicluster-engine' ,
127
- } ,
128
- spec : {
129
- host : 'testCluster.red-chesterfield.com' ,
130
- to : {
131
- kind : 'Service' ,
132
- name : 'cluster-proxy-addon-user' ,
133
- weight : 100 ,
134
- } ,
135
- port : {
136
- targetPort : 'user-port' ,
137
- } ,
138
- tls : {
139
- termination : 'reencrypt' ,
140
- insecureEdgeTerminationPolicy : 'Redirect' ,
141
- } ,
142
- wildcardPolicy : 'None' ,
143
- } ,
144
- } )
145
- nock ( 'https://testcluster.red-chesterfield.com' )
93
+ nock ( 'https://cluster-proxy-addon-user.multicluster-engine.svc.cluster.local:9092' )
146
94
. put ( '/testCluster/apis/subresources.kubevirt.io/v1/namespaces/vmNamespace/virtualmachines/vmName/start' )
147
- . reply ( 500 , {
148
- name : 'fetchError' ,
149
- message : 'error testing...' ,
150
- } )
95
+ . reply ( 500 )
151
96
const res = await request ( 'PUT' , '/virtualmachines/start' , {
152
97
managedCluster : 'testCluster' ,
153
98
vmName : 'vmName' ,
154
99
vmNamespace : 'vmNamespace' ,
155
100
} )
156
101
expect ( res . statusCode ) . toEqual ( 500 )
157
- expect ( JSON . stringify ( await parsePipedJsonBody ( res ) ) ) . toEqual (
158
- JSON . stringify ( {
159
- name : 'fetchError' ,
160
- message : 'error testing...' ,
161
- } )
162
- )
163
102
} )
164
103
165
104
it ( 'should fail with invalid route and secret' , async function ( ) {
@@ -180,10 +119,7 @@ describe('Virtual Machine actions', function () {
180
119
kind : 'SecretList' ,
181
120
items : [ ] ,
182
121
} )
183
- nock ( process . env . CLUSTER_API_URL )
184
- . get ( '/apis/route.openshift.io/v1/namespaces/multicluster-engine/routes/cluster-proxy-addon-user' )
185
- . reply ( 400 )
186
- nock ( 'https://testcluster.red-chesterfield.com' )
122
+ nock ( 'https://cluster-proxy-addon-user.multicluster-engine.svc.cluster.local:9092' )
187
123
. put ( '/testCluster/apis/subresources.kubevirt.io/v1/namespaces/vmNamespace/virtualmachines/vmName/start' )
188
124
. reply ( 500 , {
189
125
name : 'Error' ,
@@ -231,41 +167,15 @@ describe('Virtual Machine actions', function () {
231
167
} ,
232
168
] ,
233
169
} )
234
- nock ( process . env . CLUSTER_API_URL )
235
- . get ( '/apis/route.openshift.io/v1/namespaces/multicluster-engine/routes/cluster-proxy-addon-user' )
236
- . reply ( 200 , {
237
- kind : 'Route' ,
238
- apiVersion : 'route.openshift.io/v1' ,
239
- metadata : {
240
- name : 'cluster-proxy-addon-user' ,
241
- namespace : 'multicluster-engine' ,
242
- } ,
243
- spec : {
244
- host : 'testCluster.red-chesterfield.com' ,
245
- to : {
246
- kind : 'Service' ,
247
- name : 'cluster-proxy-addon-user' ,
248
- weight : 100 ,
249
- } ,
250
- port : {
251
- targetPort : 'user-port' ,
252
- } ,
253
- tls : {
254
- termination : 'reencrypt' ,
255
- insecureEdgeTerminationPolicy : 'Redirect' ,
256
- } ,
257
- wildcardPolicy : 'None' ,
258
- } ,
259
- } )
260
- nock ( 'https://testcluster.red-chesterfield.com' )
170
+ nock ( 'https://cluster-proxy-addon-user.multicluster-engine.svc.cluster.local:9092' )
261
171
. put ( '/testCluster/apis/subresources.kubevirt.io/v1/namespaces/vmNamespace/virtualmachines/vmName/start' )
262
- . reply ( 502 , 'plain text error ' , { [ constants . HTTP2_HEADER_CONTENT_TYPE ] : [ 'text/plain' ] } )
172
+ . reply ( 502 , '' , { [ constants . HTTP2_HEADER_CONTENT_TYPE ] : [ 'text/plain' ] } )
263
173
const res = await request ( 'PUT' , '/virtualmachines/start' , {
264
174
managedCluster : 'testCluster' ,
265
175
vmName : 'vmName' ,
266
176
vmNamespace : 'vmNamespace' ,
267
177
} )
268
178
expect ( res . statusCode ) . toEqual ( 502 )
269
- expect ( await parsePipedJsonBody ( res ) ) . toEqual ( 'plain text error ' )
179
+ expect ( await parsePipedJsonBody ( res ) ) . toEqual ( '' )
270
180
} )
271
181
} )
0 commit comments