Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongZhang committed May 29, 2019
1 parent 2709f6d commit f5198c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public Health health() {
boolean allPassed = true;
Health.Builder builder = new Health.Builder();
for (SofaRuntimeManager sofaRuntimeManager : SofaFramework.getRuntimeSet()) {
if (sofaRuntimeManager.getAppClassLoader().equals(this.getClass().getClassLoader())) {
continue;
}
if (!sofaRuntimeManager.isHealthCheckPassed()) {
allPassed = false;
builder.withDetail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package com.alipay.sofa.runtime.integration;

import com.alipay.sofa.healthcheck.startup.ReadinessCheckListener;
import com.alipay.sofa.runtime.api.component.ComponentName;
import com.alipay.sofa.runtime.service.binding.JvmBinding;
import com.alipay.sofa.runtime.service.component.ReferenceComponent;
Expand Down Expand Up @@ -78,6 +79,9 @@ public void testHealthChecker() {
ApplicationContext context = awareTest.getApplicationContext();
Assert.assertNotNull(context.getBean("sofaComponentHealthChecker"));

ReadinessCheckListener readinessCheckListener = (ReadinessCheckListener)context.getBean("readinessCheckListener");
Assert.assertTrue(readinessCheckListener.getHealthIndicatorStatus());

HealthChecker healthChecker = (HealthChecker) context.getBean("sofaComponentHealthChecker");
Assert.assertTrue(healthChecker.isHealthy().getStatus().equals(Status.UP));
Assert.assertEquals("SOFABoot-Components", healthChecker.getComponentName());
Expand Down

0 comments on commit f5198c8

Please sign in to comment.