107
107
import static oracle .weblogic .kubernetes .utils .LoadBalancerUtils .createIngressForDomainAndVerify ;
108
108
import static oracle .weblogic .kubernetes .utils .LoadBalancerUtils .installAndVerifyNginx ;
109
109
import static oracle .weblogic .kubernetes .utils .MonitoringUtils .checkMetricsViaPrometheus ;
110
+ import static oracle .weblogic .kubernetes .utils .MonitoringUtils .checkPrometheusAlert ;
110
111
import static oracle .weblogic .kubernetes .utils .MonitoringUtils .cleanupPromGrafanaClusterRoles ;
111
112
import static oracle .weblogic .kubernetes .utils .MonitoringUtils .createAndVerifyDomain ;
112
113
import static oracle .weblogic .kubernetes .utils .MonitoringUtils .createAndVerifyMiiImage ;
@@ -379,7 +380,7 @@ void testEndToEndViaChart() throws Exception {
379
380
}
380
381
}
381
382
382
- private void fireAlert () throws ApiException {
383
+ private void fireAlert () throws Exception {
383
384
// scale domain2
384
385
logger .info ("Scaling cluster {0} of domain {1} in namespace {2} to {3} servers." ,
385
386
cluster1Name , domain2Uid , domain2Namespace , 1 );
@@ -388,6 +389,15 @@ private void fireAlert() throws ApiException {
388
389
domain2Uid + "-" + MANAGED_SERVER_NAME_BASE , replicaCount , managedServersCount ,
389
390
null , null );
390
391
392
+ logger .info ("Wait for the prometheus to create alert " );
393
+ checkPrometheusAlert ("ClusterWarning" , hostPortPrometheus ,
394
+ prometheusReleaseName
395
+ + "." + monitoringNS );
396
+
397
+ logger .info ("Wait for the prometheus to fire alert " );
398
+ checkPrometheusAlert ("firing" , hostPortPrometheus ,
399
+ prometheusReleaseName
400
+ + "." + monitoringNS );
391
401
//check webhook log for firing alert
392
402
List <V1Pod > pods = listPods (webhookNS , "app=webhook" ).getItems ();
393
403
assertNotNull ((pods ), "No pods are running in namespace : " + webhookNS );
@@ -402,7 +412,7 @@ private void fireAlert() throws ApiException {
402
412
403
413
testUntil (withLongRetryPolicy ,
404
414
assertDoesNotThrow (() -> searchPodLogForKey (pod ,
405
- "Some WLS cluster has only one running server for more than 1 minutes " ),
415
+ "Some WLS cluster has only one running server for more than 15 secs " ),
406
416
"webhook failed to fire alert" ),
407
417
logger ,
408
418
"webhook to fire alert" );
@@ -554,7 +564,7 @@ public void tearDownAll() {
554
564
deletePersistentVolumeClaim ("pvc-" + grafanaReleaseName , monitoringNS );
555
565
deletePersistentVolume ("pv-test" + grafanaReleaseName );
556
566
deleteNamespace (monitoringNS );
557
- uninstallDeploymentService (webhookDepl , webhookService );
567
+ // uninstallDeploymentService(webhookDepl, webhookService);
558
568
uninstallDeploymentService (coordinatorDepl , coordinatorService );
559
569
if (nginxHelmParams != null ) {
560
570
assertThat (uninstallNginx (nginxHelmParams .getHelmParams ()))
0 commit comments