@@ -42,9 +42,6 @@ import (
42
42
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
43
43
)
44
44
45
- // TestContext should be used by all tests to access common context data.
46
- var TestContext framework.TestContextType
47
-
48
45
// New local storage types to support local storage capacity isolation
49
46
var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation"
50
47
@@ -154,29 +151,29 @@ func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVers
154
151
155
152
// SkipUnlessNodeCountIsAtLeast skips if the number of nodes is less than the minNodeCount.
156
153
func SkipUnlessNodeCountIsAtLeast (minNodeCount int ) {
157
- if TestContext .CloudConfig .NumNodes < minNodeCount {
158
- skipInternalf (1 , "Requires at least %d nodes (not %d)" , minNodeCount , TestContext .CloudConfig .NumNodes )
154
+ if framework . TestContext .CloudConfig .NumNodes < minNodeCount {
155
+ skipInternalf (1 , "Requires at least %d nodes (not %d)" , minNodeCount , framework . TestContext .CloudConfig .NumNodes )
159
156
}
160
157
}
161
158
162
159
// SkipUnlessNodeCountIsAtMost skips if the number of nodes is greater than the maxNodeCount.
163
160
func SkipUnlessNodeCountIsAtMost (maxNodeCount int ) {
164
- if TestContext .CloudConfig .NumNodes > maxNodeCount {
165
- skipInternalf (1 , "Requires at most %d nodes (not %d)" , maxNodeCount , TestContext .CloudConfig .NumNodes )
161
+ if framework . TestContext .CloudConfig .NumNodes > maxNodeCount {
162
+ skipInternalf (1 , "Requires at most %d nodes (not %d)" , maxNodeCount , framework . TestContext .CloudConfig .NumNodes )
166
163
}
167
164
}
168
165
169
166
// SkipIfProviderIs skips if the provider is included in the unsupportedProviders.
170
167
func SkipIfProviderIs (unsupportedProviders ... string ) {
171
168
if framework .ProviderIs (unsupportedProviders ... ) {
172
- skipInternalf (1 , "Not supported for providers %v (found %s)" , unsupportedProviders , TestContext .Provider )
169
+ skipInternalf (1 , "Not supported for providers %v (found %s)" , unsupportedProviders , framework . TestContext .Provider )
173
170
}
174
171
}
175
172
176
173
// SkipUnlessProviderIs skips if the provider is not included in the supportedProviders.
177
174
func SkipUnlessProviderIs (supportedProviders ... string ) {
178
175
if ! framework .ProviderIs (supportedProviders ... ) {
179
- skipInternalf (1 , "Only supported for providers %v (not %s)" , supportedProviders , TestContext .Provider )
176
+ skipInternalf (1 , "Only supported for providers %v (not %s)" , supportedProviders , framework . TestContext .Provider )
180
177
}
181
178
}
182
179
@@ -205,21 +202,21 @@ func SkipIfMultizone(c clientset.Interface) {
205
202
// SkipUnlessMasterOSDistroIs skips if the master OS distro is not included in the supportedMasterOsDistros.
206
203
func SkipUnlessMasterOSDistroIs (supportedMasterOsDistros ... string ) {
207
204
if ! framework .MasterOSDistroIs (supportedMasterOsDistros ... ) {
208
- skipInternalf (1 , "Only supported for master OS distro %v (not %s)" , supportedMasterOsDistros , TestContext .MasterOSDistro )
205
+ skipInternalf (1 , "Only supported for master OS distro %v (not %s)" , supportedMasterOsDistros , framework . TestContext .MasterOSDistro )
209
206
}
210
207
}
211
208
212
209
// SkipUnlessNodeOSDistroIs skips if the node OS distro is not included in the supportedNodeOsDistros.
213
210
func SkipUnlessNodeOSDistroIs (supportedNodeOsDistros ... string ) {
214
211
if ! framework .NodeOSDistroIs (supportedNodeOsDistros ... ) {
215
- skipInternalf (1 , "Only supported for node OS distro %v (not %s)" , supportedNodeOsDistros , TestContext .NodeOSDistro )
212
+ skipInternalf (1 , "Only supported for node OS distro %v (not %s)" , supportedNodeOsDistros , framework . TestContext .NodeOSDistro )
216
213
}
217
214
}
218
215
219
216
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
220
217
func SkipIfNodeOSDistroIs (unsupportedNodeOsDistros ... string ) {
221
218
if framework .NodeOSDistroIs (unsupportedNodeOsDistros ... ) {
222
- skipInternalf (1 , "Not supported for node OS distro %v (is %s)" , unsupportedNodeOsDistros , TestContext .NodeOSDistro )
219
+ skipInternalf (1 , "Not supported for node OS distro %v (is %s)" , unsupportedNodeOsDistros , framework . TestContext .NodeOSDistro )
223
220
}
224
221
}
225
222
@@ -236,8 +233,8 @@ func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersio
236
233
237
234
// SkipUnlessSSHKeyPresent skips if no SSH key is found.
238
235
func SkipUnlessSSHKeyPresent () {
239
- if _ , err := e2essh .GetSigner (TestContext .Provider ); err != nil {
240
- skipInternalf (1 , "No SSH Key for provider %s: '%v'" , TestContext .Provider , err )
236
+ if _ , err := e2essh .GetSigner (framework . TestContext .Provider ); err != nil {
237
+ skipInternalf (1 , "No SSH Key for provider %s: '%v'" , framework . TestContext .Provider , err )
241
238
}
242
239
}
243
240
@@ -265,19 +262,19 @@ func SkipIfAppArmorNotSupported() {
265
262
// RunIfContainerRuntimeIs runs if the container runtime is included in the runtimes.
266
263
func RunIfContainerRuntimeIs (runtimes ... string ) {
267
264
for _ , containerRuntime := range runtimes {
268
- if containerRuntime == TestContext .ContainerRuntime {
265
+ if containerRuntime == framework . TestContext .ContainerRuntime {
269
266
return
270
267
}
271
268
}
272
- skipInternalf (1 , "Skipped because container runtime %q is not in %s" , TestContext .ContainerRuntime , runtimes )
269
+ skipInternalf (1 , "Skipped because container runtime %q is not in %s" , framework . TestContext .ContainerRuntime , runtimes )
273
270
}
274
271
275
272
// RunIfSystemSpecNameIs runs if the system spec name is included in the names.
276
273
func RunIfSystemSpecNameIs (names ... string ) {
277
274
for _ , name := range names {
278
- if name == TestContext .SystemSpecName {
275
+ if name == framework . TestContext .SystemSpecName {
279
276
return
280
277
}
281
278
}
282
- skipInternalf (1 , "Skipped because system spec name %q is not in %v" , TestContext .SystemSpecName , names )
279
+ skipInternalf (1 , "Skipped because system spec name %q is not in %v" , framework . TestContext .SystemSpecName , names )
283
280
}
0 commit comments