Search in sources :

Example 6 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method disablingAnOriginRemovesItFromInactiveSetAndStopsHealthCheckMonitoring.

@Test
public void disablingAnOriginRemovesItFromInactiveSetAndStopsHealthCheckMonitoring() {
    inventory.setOrigins(ORIGIN_1);
    inventory.originUnhealthy(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    assertThat(inventory.originCount(ACTIVE), is(0));
    assertThat(inventory.originCount(DISABLED), is(1));
    verify(monitor).stopMonitoring(singleton(ORIGIN_1));
    assertThat(gaugeValue("generic-app", "app-01"), isValue(-1.0));
    verify(eventBus, times(3)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Example 7 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method disablingAnOriginRemovesItFromActiveSetAndStopsHealthCheckMonitoring.

@Test
public void disablingAnOriginRemovesItFromActiveSetAndStopsHealthCheckMonitoring() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    assertThat(inventory.originCount(ACTIVE), is(0));
    assertThat(inventory.originCount(DISABLED), is(1));
    verify(monitor).stopMonitoring(singleton(ORIGIN_1));
    assertThat(gaugeValue("generic-app", "app-01"), isValue(-1.0));
    verify(eventBus, times(2)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Aggregations

DisableOrigin (com.hotels.styx.client.origincommands.DisableOrigin)7 Test (org.junit.jupiter.api.Test)7 OriginsSnapshot (com.hotels.styx.api.extension.OriginsSnapshot)5 EnableOrigin (com.hotels.styx.client.origincommands.EnableOrigin)3