@@ -41,9 +41,13 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
41
41
crc versioned.Interface
42
42
ns corev1.Namespace
43
43
)
44
+
44
45
BeforeEach (func () {
45
46
c = newKubeClient ()
46
47
crc = newCRClient ()
48
+ // Create a new e2e kube client session tracking and tagging created resources
49
+ ctx .Ctx ().NewClientSession ()
50
+
47
51
namespaceName := genName ("catsrc-e2e-" )
48
52
og := operatorsv1.OperatorGroup {
49
53
ObjectMeta : metav1.ObjectMeta {
@@ -56,6 +60,9 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
56
60
57
61
AfterEach (func () {
58
62
TeardownNamespace (ns .GetName ())
63
+
64
+ // Tear down e2e client and thereby any test resources created with it
65
+ Expect (ctx .Ctx ().EndClientSession ()).To (Succeed ())
59
66
})
60
67
61
68
It ("loading between restarts" , func () {
@@ -496,7 +503,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
496
503
},
497
504
}
498
505
499
- addressSource , err = crc . OperatorsV1alpha1 ().CatalogSources ( ns . GetName ()) .Create (context .Background (), addressSource , metav1. CreateOptions {} )
506
+ err = ctx . Ctx ().E2EClient () .Create (context .TODO (), addressSource )
500
507
Expect (err ).ShouldNot (HaveOccurred ())
501
508
defer func () {
502
509
err := crc .OperatorsV1alpha1 ().CatalogSources (ns .GetName ()).Delete (context .Background (), addressSourceName , metav1.DeleteOptions {})
@@ -622,7 +629,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
622
629
},
623
630
}
624
631
625
- source , err := crc . OperatorsV1alpha1 ().CatalogSources ( source . GetNamespace ()) .Create (context .Background (), source , metav1. CreateOptions {} )
632
+ err := ctx . Ctx ().E2EClient () .Create (context .TODO (), source )
626
633
Expect (err ).ShouldNot (HaveOccurred ())
627
634
628
635
// Wait for a new registry pod to be created
@@ -757,7 +764,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
757
764
},
758
765
}
759
766
760
- source , err = crc . OperatorsV1alpha1 ().CatalogSources ( source . GetNamespace ()) .Create (context .Background (), source , metav1. CreateOptions {} )
767
+ err = ctx . Ctx ().E2EClient () .Create (context .TODO (), source )
761
768
Expect (err ).ShouldNot (HaveOccurred ())
762
769
defer func () {
763
770
err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Delete (context .Background (), source .GetName (), metav1.DeleteOptions {})
@@ -914,7 +921,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
914
921
},
915
922
}
916
923
917
- source , err := crc . OperatorsV1alpha1 ().CatalogSources ( source . GetNamespace ()) .Create (context .Background (), source , metav1. CreateOptions {} )
924
+ err := ctx . Ctx ().E2EClient () .Create (context .TODO (), source )
918
925
Expect (err ).ShouldNot (HaveOccurred ())
919
926
defer func () {
920
927
err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Delete (context .Background (), source .GetName (), metav1.DeleteOptions {})
@@ -1004,9 +1011,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
1004
1011
// a) the new update pod is spun up roughly in line with the registry polling interval
1005
1012
// b) the update pod is removed quickly when the image is found to not have changed
1006
1013
// This is more of a behavioral test that ensures the feature is working as designed.
1007
-
1008
1014
c := newKubeClient ()
1009
- crc := newCRClient ()
1010
1015
1011
1016
sourceName := genName ("catalog-" )
1012
1017
source := & v1alpha1.CatalogSource {
@@ -1030,7 +1035,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
1030
1035
},
1031
1036
}
1032
1037
1033
- source , err := crc . OperatorsV1alpha1 ().CatalogSources ( source . GetNamespace ()) .Create (context .Background (), source , metav1. CreateOptions {} )
1038
+ err := ctx . Ctx ().E2EClient () .Create (context .TODO (), source )
1034
1039
Expect (err ).ToNot (HaveOccurred ())
1035
1040
1036
1041
// wait for new catalog source pod to be created and report ready
@@ -1095,7 +1100,7 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
1095
1100
1096
1101
var err error
1097
1102
Eventually (func () error {
1098
- source , err = crc . OperatorsV1alpha1 ().CatalogSources ( source . GetNamespace ()) .Create (context .Background (), source , metav1. CreateOptions {} )
1103
+ err := ctx . Ctx ().E2EClient () .Create (context .TODO (), source )
1099
1104
return err
1100
1105
}).Should (Succeed ())
1101
1106
@@ -1221,7 +1226,7 @@ func replicateCatalogPod(c operatorclient.ClientInterface, catalog *v1alpha1.Cat
1221
1226
Spec : pod .Spec ,
1222
1227
}
1223
1228
1224
- copied , err = c . KubernetesInterface ().CoreV1 ().Pods ( catalog . GetNamespace ()). Create (context .Background (), copied , metav1. CreateOptions {} )
1229
+ err = ctx . Ctx ().E2EClient ().Create (context .TODO (), copied )
1225
1230
Expect (err ).ToNot (HaveOccurred ())
1226
1231
1227
1232
return copied
0 commit comments