@@ -80,6 +80,10 @@ func TestOperatorGroup(t *testing.T) {
8080 // Verify copied CVS is deleted
8181 defer cleaner .NotifyTestComplete (t , true )
8282
83+ log := func (s string ) {
84+ t .Logf ("%s: %s" , time .Now ().Format ("15:04:05.9999" ), s )
85+ }
86+
8387 c := newKubeClient (t )
8488 crc := newCRClient (t )
8589 csvName := genName ("another-csv-" ) // must be lowercase for DNS-1123 validation
@@ -114,14 +118,14 @@ func TestOperatorGroup(t *testing.T) {
114118 require .NoError (t , err )
115119 }()
116120
117- t . Log ("Creating CRD" )
121+ log ("Creating CRD" )
118122 mainCRDPlural := genName ("opgroup" )
119123 mainCRD := newCRD (mainCRDPlural )
120124 cleanupCRD , err := createCRD (c , mainCRD )
121125 require .NoError (t , err )
122126 defer cleanupCRD ()
123127
124- t . Log ("Creating operator group" )
128+ log ("Creating operator group" )
125129 operatorGroup := v1.OperatorGroup {
126130 ObjectMeta : metav1.ObjectMeta {
127131 Name : genName ("e2e-operator-group-" ),
@@ -144,7 +148,7 @@ func TestOperatorGroup(t *testing.T) {
144148 Namespaces : []string {opGroupNamespace , createdOtherNamespace .GetName ()},
145149 }
146150
147- t . Log ("Waiting on operator group to have correct status" )
151+ log ("Waiting on operator group to have correct status" )
148152 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
149153 fetched , fetchErr := crc .OperatorsV1 ().OperatorGroups (opGroupNamespace ).Get (operatorGroup .Name , metav1.GetOptions {})
150154 if fetchErr != nil {
@@ -158,7 +162,7 @@ func TestOperatorGroup(t *testing.T) {
158162 })
159163 require .NoError (t , err )
160164
161- t . Log ("Creating CSV" )
165+ log ("Creating CSV" )
162166 // Generate permissions
163167 serviceAccountName := genName ("nginx-sa" )
164168 permissions := []install.StrategyDeploymentPermissions {
@@ -219,25 +223,25 @@ func TestOperatorGroup(t *testing.T) {
219223 createdCSV , err := crc .OperatorsV1alpha1 ().ClusterServiceVersions (opGroupNamespace ).Create (& aCSV )
220224 require .NoError (t , err )
221225
222- t . Log ("wait for CSV to succeed" )
226+ log ("wait for CSV to succeed" )
223227 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
224228 fetched , err := crc .OperatorsV1alpha1 ().ClusterServiceVersions (opGroupNamespace ).Get (createdCSV .GetName (), metav1.GetOptions {})
225229 if err != nil {
226230 return false , err
227231 }
228- t . Logf ("%s (%s): %s" , fetched .Status .Phase , fetched .Status .Reason , fetched .Status .Message )
232+ log ( fmt . Sprintf ("%s (%s): %s" , fetched .Status .Phase , fetched .Status .Reason , fetched .Status .Message ) )
229233 return csvSucceededChecker (fetched ), nil
230234 })
231235 require .NoError (t , err )
232236
233- t . Log ("Waiting for operator namespace csv to have annotations" )
237+ log ("Waiting for operator namespace csv to have annotations" )
234238 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
235239 fetchedCSV , fetchErr := crc .OperatorsV1alpha1 ().ClusterServiceVersions (opGroupNamespace ).Get (csvName , metav1.GetOptions {})
236240 if fetchErr != nil {
237241 if errors .IsNotFound (fetchErr ) {
238242 return false , nil
239243 }
240- t . Logf ("Error (in %v): %v" , testNamespace , fetchErr .Error ())
244+ log ( fmt . Sprintf ("Error (in %v): %v" , testNamespace , fetchErr .Error () ))
241245 return false , fetchErr
242246 }
243247 if checkOperatorGroupAnnotations (fetchedCSV , & operatorGroup , true , bothNamespaceNames ) == nil {
@@ -247,14 +251,14 @@ func TestOperatorGroup(t *testing.T) {
247251 })
248252 require .NoError (t , err )
249253
250- t . Log ("Waiting for target namespace csv to have annotations (but not target namespaces)" )
254+ log ("Waiting for target namespace csv to have annotations (but not target namespaces)" )
251255 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
252256 fetchedCSV , fetchErr := crc .OperatorsV1alpha1 ().ClusterServiceVersions (otherNamespaceName ).Get (csvName , metav1.GetOptions {})
253257 if fetchErr != nil {
254258 if errors .IsNotFound (fetchErr ) {
255259 return false , nil
256260 }
257- t . Logf ("Error (in %v): %v" , otherNamespaceName , fetchErr .Error ())
261+ log ( fmt . Sprintf ("Error (in %v): %v" , otherNamespaceName , fetchErr .Error () ))
258262 return false , fetchErr
259263 }
260264 if checkOperatorGroupAnnotations (fetchedCSV , & operatorGroup , false , "" ) == nil {
@@ -264,7 +268,7 @@ func TestOperatorGroup(t *testing.T) {
264268 return false , nil
265269 })
266270
267- t . Log ("Checking status on csv in target namespace" )
271+ log ("Checking status on csv in target namespace" )
268272 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
269273 fetchedCSV , fetchErr := crc .OperatorsV1alpha1 ().ClusterServiceVersions (otherNamespaceName ).Get (csvName , metav1.GetOptions {})
270274 if fetchErr != nil {
@@ -281,7 +285,7 @@ func TestOperatorGroup(t *testing.T) {
281285 })
282286 require .NoError (t , err )
283287
284- t . Log ("Waiting on deployment to have correct annotations" )
288+ log ("Waiting on deployment to have correct annotations" )
285289 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
286290 createdDeployment , err := c .GetDeployment (opGroupNamespace , deploymentName )
287291 if err != nil {
@@ -325,7 +329,7 @@ func TestOperatorGroup(t *testing.T) {
325329
326330 ruleChecker := install .NewCSVRuleChecker (roleInformer .Lister (), roleBindingInformer .Lister (), clusterRoleInformer .Lister (), clusterRoleBindingInformer .Lister (), & aCSV )
327331
328- t . Log ("Waiting for operator to have rbac in target namespace" )
332+ log ("Waiting for operator to have rbac in target namespace" )
329333 err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
330334 for _ , perm := range permissions {
331335 sa , err := c .GetServiceAccount (opGroupNamespace , perm .ServiceAccountName )
@@ -368,7 +372,7 @@ func TestOperatorGroup(t *testing.T) {
368372 require .Equal (t , viewPolicyRules , viewRole .Rules )
369373
370374 // Unsupport all InstallModes
371- t . Log ("unsupporting all csv installmodes" )
375+ log ("unsupporting all csv installmodes" )
372376 fetchedCSV , err := crc .OperatorsV1alpha1 ().ClusterServiceVersions (opGroupNamespace ).Get (csvName , metav1.GetOptions {})
373377 require .NoError (t , err , "could not fetch csv" )
374378 fetchedCSV .Spec .InstallModes = []v1alpha1.InstallMode {}
@@ -380,11 +384,11 @@ func TestOperatorGroup(t *testing.T) {
380384 require .NoError (t , err , "csv did not transition to failed as expected" )
381385
382386 // ensure deletion cleans up copied CSV
383- t . Log ("deleting parent csv" )
387+ log ("deleting parent csv" )
384388 err = crc .OperatorsV1alpha1 ().ClusterServiceVersions (opGroupNamespace ).Delete (csvName , & metav1.DeleteOptions {})
385389 require .NoError (t , err )
386390
387- t . Log ("waiting for orphaned csv to be deleted" )
391+ log ("waiting for orphaned csv to be deleted" )
388392 err = waitForDelete (func () error {
389393 _ , err = crc .OperatorsV1alpha1 ().ClusterServiceVersions (otherNamespaceName ).Get (csvName , metav1.GetOptions {})
390394 return err
0 commit comments