@@ -134,14 +134,17 @@ func TestMarklogicCluster(t *testing.T) {
134134 if err != nil {
135135 t .Fatalf ("Failed to install grafana helm chart: %v" , err )
136136 }
137-
137+ // Wait for Grafana pod to be ready
138+ time .Sleep (5 * time .Second ) // Give some time for Grafana to start
138139 podList := & corev1.PodList {}
139140 if err := client .Resources ().List (ctx , podList , func (lo * metav1.ListOptions ) {
140141 lo .FieldSelector = "metadata.namespace=" + "grafana"
141142 }); err != nil {
142143 t .Fatal (err )
143144 }
144-
145+ if len (podList .Items ) == 0 {
146+ t .Fatal ("No Grafana pods found" )
147+ }
145148 grafanaPodName := podList .Items [0 ].Name
146149 err = utils .WaitForPod (ctx , t , client , "grafana" , grafanaPodName , 120 * time .Second )
147150 if err != nil {
@@ -245,6 +248,10 @@ func TestMarklogicCluster(t *testing.T) {
245248 }); err != nil {
246249 t .Fatal (err )
247250 }
251+ time .Sleep (5 * time .Second ) // Wait for Grafana to be fully ready
252+ if len (podList .Items ) == 0 {
253+ t .Fatal ("No Grafana pods found" )
254+ }
248255 grafanaPodName := podList .Items [0 ].Name
249256 grafanaAdminUser , grafanaAdminPassword , err := utils .GetSecretData (ctx , client , "grafana" , "grafana" , "admin-user" , "admin-password" )
250257 if err != nil {
@@ -337,7 +344,7 @@ func TestMarklogicCluster(t *testing.T) {
337344 if err := client .Resources ().Get (ctx , "marklogicclusters" , mlNamespace , & mlcluster ); err != nil {
338345 t .Fatal (err )
339346 }
340-
347+
341348 mlcluster .Spec .MarkLogicGroups [0 ].Resources = & resources
342349 if err := client .Resources ().Update (ctx , & mlcluster ); err != nil {
343350 t .Log ("Failed to update MarkLogic group resources" )
0 commit comments