@@ -93,8 +93,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
93
93
route := & routev1.Route {}
94
94
95
95
It ("Should create a Route to expose the traffic externally" , func () {
96
- ctx := context .Background ()
97
-
98
96
By ("By creating a new Notebook" )
99
97
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
100
98
@@ -185,8 +183,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
185
183
})
186
184
187
185
It ("Should create a RoleBinding when the referenced Role exists" , func () {
188
- ctx := context .Background ()
189
-
190
186
By ("Creating a Notebook and ensuring the Role exists" )
191
187
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
192
188
time .Sleep (interval )
@@ -217,8 +213,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
217
213
})
218
214
219
215
It ("Should delete the RoleBinding when the Notebook is deleted" , func () {
220
- ctx := context .Background ()
221
-
222
216
By ("Ensuring the RoleBinding exists" )
223
217
roleBinding := & rbacv1.RoleBinding {}
224
218
Eventually (func () error {
@@ -244,7 +238,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
244
238
)
245
239
246
240
It ("Should mount a trusted-ca when it exists on the given namespace" , func () {
247
- ctx := context .Background ()
248
241
logger := logr .Discard ()
249
242
250
243
By ("By simulating the existence of odh-trusted-ca-bundle ConfigMap" )
@@ -381,8 +374,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
381
374
route := & routev1.Route {}
382
375
383
376
It ("Should create a Route to expose the traffic externally" , func () {
384
- ctx := context .Background ()
385
-
386
377
By ("By creating a new Notebook" )
387
378
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
388
379
time .Sleep (interval )
@@ -471,8 +462,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
471
462
notebook := createNotebook (Name , Namespace )
472
463
473
464
It ("Should update the Notebook specification" , func () {
474
- ctx := context .Background ()
475
-
476
465
By ("By creating a new Notebook" )
477
466
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
478
467
@@ -492,7 +481,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
492
481
})
493
482
494
483
It ("When notebook CR is updated, should mount a trusted-ca if it exists on the given namespace" , func () {
495
- ctx := context .Background ()
496
484
logger := logr .Discard ()
497
485
498
486
By ("By simulating the existence of odh-trusted-ca-bundle ConfigMap" )
@@ -622,8 +610,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
622
610
notebookOAuthNetworkPolicy := & netv1.NetworkPolicy {}
623
611
624
612
It ("Should create network policies to restrict undesired traffic" , func () {
625
- ctx := context .Background ()
626
-
627
613
By ("By creating a new Notebook" )
628
614
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
629
615
@@ -803,8 +789,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
803
789
}
804
790
805
791
It ("Should inject the OAuth proxy as a sidecar container" , func () {
806
- ctx := context .Background ()
807
-
808
792
By ("By creating a new Notebook" )
809
793
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
810
794
@@ -1045,7 +1029,6 @@ var _ = Describe("The Openshift Notebook controller", func() {
1045
1029
It ("Should not add OAuth sidecar" , func () {
1046
1030
notebook := createNotebook (name , namespace )
1047
1031
notebook .SetAnnotations (map [string ]string {AnnotationServiceMesh : "true" })
1048
- ctx := context .Background ()
1049
1032
Expect (cli .Create (ctx , notebook )).Should (Succeed ())
1050
1033
1051
1034
actualNotebook := & nbv1.Notebook {}
@@ -1060,7 +1043,7 @@ var _ = Describe("The Openshift Notebook controller", func() {
1060
1043
It ("Should not define OAuth network policy" , func () {
1061
1044
policies := & netv1.NetworkPolicyList {}
1062
1045
Eventually (func () error {
1063
- return cli .List (context . Background () , policies , client .InNamespace (namespace ))
1046
+ return cli .List (ctx , policies , client .InNamespace (namespace ))
1064
1047
}, duration , interval ).Should (Succeed ())
1065
1048
1066
1049
Expect (policies .Items ).To (Not (ContainElement (notebookOAuthNetworkPolicy )))
@@ -1069,7 +1052,7 @@ var _ = Describe("The Openshift Notebook controller", func() {
1069
1052
It ("Should not create routes" , func () {
1070
1053
routes := & routev1.RouteList {}
1071
1054
Eventually (func () error {
1072
- return cli .List (context . Background () , routes , client .InNamespace (namespace ))
1055
+ return cli .List (ctx , routes , client .InNamespace (namespace ))
1073
1056
}, duration , interval ).Should (Succeed ())
1074
1057
1075
1058
Expect (routes .Items ).To (BeEmpty ())
@@ -1080,7 +1063,7 @@ var _ = Describe("The Openshift Notebook controller", func() {
1080
1063
1081
1064
serviceAccounts := & corev1.ServiceAccountList {}
1082
1065
Eventually (func () error {
1083
- return cli .List (context . Background () , serviceAccounts , client .InNamespace (namespace ))
1066
+ return cli .List (ctx , serviceAccounts , client .InNamespace (namespace ))
1084
1067
}, duration , interval ).Should (Succeed ())
1085
1068
1086
1069
Expect (serviceAccounts .Items ).ToNot (ContainElement (oauthServiceAccount ))
@@ -1094,7 +1077,7 @@ var _ = Describe("The Openshift Notebook controller", func() {
1094
1077
},
1095
1078
}
1096
1079
Eventually (func () error {
1097
- return cli .List (context . Background () , secrets , client .InNamespace (namespace ))
1080
+ return cli .List (ctx , secrets , client .InNamespace (namespace ))
1098
1081
}, duration , interval ).Should (Succeed ())
1099
1082
1100
1083
Expect (secrets .Items ).To (BeEmpty ())
0 commit comments