@@ -1079,11 +1079,18 @@ func getHTTPResponse(client *http.Client, name string) (int, http.Header, string
10791079// assertCatalogSource checks if the CatalogSource of the given name exists,
10801080// and returns an error if not.
10811081func assertCatalogSource (t * testing.T , namespace , csName string ) error {
1082+ return assertCatalogSourceWithConfig (t , namespace , csName , 1 * time .Second , 30 * time .Second )
1083+ }
1084+
1085+ // assertCatalogSourceWithConfig checks if the CatalogSource of the given name exists,
1086+ // and returns an error if not. It uses configurable parameters such as polling interval
1087+ // and timeout.
1088+ func assertCatalogSourceWithConfig (t * testing.T , namespace , csName string , interval , timeout time.Duration ) error {
10821089 t .Helper ()
10831090 catalogSource := & operatorsv1alpha1.CatalogSource {}
10841091 nsName := types.NamespacedName {Namespace : namespace , Name : csName }
10851092
1086- err := wait .PollUntilContextTimeout (context .Background (), 1 * time . Second , 30 * time . Second , false , func (context context.Context ) (bool , error ) {
1093+ return wait .PollUntilContextTimeout (context .Background (), interval , timeout , false , func (context context.Context ) (bool , error ) {
10871094 if err := kclient .Get (context , nsName , catalogSource ); err != nil {
10881095 t .Logf ("Failed to get CatalogSource %s: %v. Retrying..." , csName , err )
10891096 return false , nil
@@ -1095,7 +1102,6 @@ func assertCatalogSource(t *testing.T, namespace, csName string) error {
10951102 t .Logf ("Found CatalogSource %s but could not determine last observed state. Retrying..." , catalogSource .Name )
10961103 return false , nil
10971104 })
1098- return err
10991105}
11001106
11011107// assertIstio checks if the Istio exists in a ready state,
0 commit comments