@@ -144,7 +144,7 @@ func deployChartsAndApps(t *testing.T) {
144
144
require .True (t , setKubeTestEnv , "the environment variable KUBE_TEST_ENV must be set" )
145
145
kubeConfig , err := clientcmd .BuildConfigFromFlags ("" , testKubeConfig )
146
146
require .NoError (t , err )
147
- clientset , err := kubernetes .NewForConfig (kubeConfig )
147
+ client , err := kubernetes .NewForConfig (kubeConfig )
148
148
require .NoError (t , err )
149
149
150
150
chartPath := filepath .Join (".." , "helm-charts" , "splunk-otel-collector" )
@@ -215,9 +215,9 @@ func deployChartsAndApps(t *testing.T) {
215
215
require .NoError (t , err )
216
216
}
217
217
218
- waitForAllDeploymentsToStart (t , clientset )
218
+ waitForAllDeploymentsToStart (t , client )
219
219
220
- deployments := clientset .AppsV1 ().Deployments ("default" )
220
+ deployments := client .AppsV1 ().Deployments ("default" )
221
221
222
222
decode := scheme .Codecs .UniversalDeserializer ().Decode
223
223
// NodeJS test app
@@ -291,14 +291,14 @@ func deployChartsAndApps(t *testing.T) {
291
291
groupVersionKind .Kind == "Namespace" {
292
292
nm := obj .(* corev1.Namespace )
293
293
namespaces = append (namespaces , nm )
294
- nms := clientset .CoreV1 ().Namespaces ()
294
+ nms := client .CoreV1 ().Namespaces ()
295
295
_ , err := nms .Create (context .Background (), nm , metav1.CreateOptions {})
296
296
require .NoError (t , err )
297
297
t .Logf ("Deployed namespace %s" , nm .Name )
298
298
}
299
299
}
300
300
301
- waitForAllNamespacesToBeCreated (t , clientset )
301
+ waitForAllNamespacesToBeCreated (t , client )
302
302
303
303
for _ , resourceYAML := range strings .Split (string (jobstream ), "---" ) {
304
304
if len (resourceYAML ) == 0 {
@@ -316,14 +316,14 @@ func deployChartsAndApps(t *testing.T) {
316
316
groupVersionKind .Kind == "Job" {
317
317
job := obj .(* batchv1.Job )
318
318
jobs = append (jobs , job )
319
- jobClient := clientset .BatchV1 ().Jobs (job .Namespace )
319
+ jobClient := client .BatchV1 ().Jobs (job .Namespace )
320
320
_ , err := jobClient .Create (context .Background (), job , metav1.CreateOptions {})
321
321
require .NoError (t , err )
322
322
t .Logf ("Deployed job %s" , job .Name )
323
323
}
324
324
}
325
325
326
- waitForAllDeploymentsToStart (t , clientset )
326
+ waitForAllDeploymentsToStart (t , client )
327
327
328
328
t .Cleanup (func () {
329
329
if os .Getenv ("SKIP_TEARDOWN" ) == "true" {
@@ -342,10 +342,10 @@ func teardown(t *testing.T) {
342
342
decode := scheme .Codecs .UniversalDeserializer ().Decode
343
343
kubeConfig , err := clientcmd .BuildConfigFromFlags ("" , testKubeConfig )
344
344
require .NoError (t , err )
345
- clientset , err := kubernetes .NewForConfig (kubeConfig )
345
+ client , err := kubernetes .NewForConfig (kubeConfig )
346
346
require .NoError (t , err )
347
347
waitTime := int64 (0 )
348
- deployments := clientset .AppsV1 ().Deployments ("default" )
348
+ deployments := client .AppsV1 ().Deployments ("default" )
349
349
require .NoError (t , err )
350
350
_ = deployments .Delete (context .Background (), "nodejs-test" , metav1.DeleteOptions {
351
351
GracePeriodSeconds : & waitTime ,
@@ -388,13 +388,13 @@ func teardown(t *testing.T) {
388
388
}
389
389
}
390
390
for _ , job := range jobs {
391
- jobClient := clientset .BatchV1 ().Jobs (job .Namespace )
391
+ jobClient := client .BatchV1 ().Jobs (job .Namespace )
392
392
_ = jobClient .Delete (context .Background (), job .Name , metav1.DeleteOptions {
393
393
GracePeriodSeconds : & waitTime ,
394
394
})
395
395
}
396
396
for _ , nm := range namespaces {
397
- nmClient := clientset .CoreV1 ().Namespaces ()
397
+ nmClient := client .CoreV1 ().Namespaces ()
398
398
_ = nmClient .Delete (context .Background (), nm .Name , metav1.DeleteOptions {
399
399
GracePeriodSeconds : & waitTime ,
400
400
})
@@ -1190,9 +1190,9 @@ func testHECMetrics(t *testing.T) {
1190
1190
checkMetricsAreEmitted (t , hecMetricsConsumer , metricNames )
1191
1191
}
1192
1192
1193
- func waitForAllDeploymentsToStart (t * testing.T , clientset * kubernetes.Clientset ) {
1193
+ func waitForAllDeploymentsToStart (t * testing.T , client * kubernetes.Clientset ) {
1194
1194
require .Eventually (t , func () bool {
1195
- di , err := clientset .AppsV1 ().Deployments ("default" ).List (context .Background (), metav1.ListOptions {})
1195
+ di , err := client .AppsV1 ().Deployments ("default" ).List (context .Background (), metav1.ListOptions {})
1196
1196
require .NoError (t , err )
1197
1197
for _ , d := range di .Items {
1198
1198
if d .Status .ReadyReplicas != d .Status .Replicas {
@@ -1210,9 +1210,9 @@ func waitForAllDeploymentsToStart(t *testing.T, clientset *kubernetes.Clientset)
1210
1210
}, 5 * time .Minute , 10 * time .Second )
1211
1211
}
1212
1212
1213
- func waitForAllNamespacesToBeCreated (t * testing.T , clientset * kubernetes.Clientset ) {
1213
+ func waitForAllNamespacesToBeCreated (t * testing.T , client * kubernetes.Clientset ) {
1214
1214
require .Eventually (t , func () bool {
1215
- nms , err := clientset .CoreV1 ().Namespaces ().List (context .Background (), metav1.ListOptions {})
1215
+ nms , err := client .CoreV1 ().Namespaces ().List (context .Background (), metav1.ListOptions {})
1216
1216
require .NoError (t , err )
1217
1217
for _ , d := range nms .Items {
1218
1218
if d .Status .Phase != corev1 .NamespaceActive {
0 commit comments