Search in sources :

Example 1 with EnableOrigin

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

the class OriginsInventoryTest method willNotEnableOriginsNotBelongingToTheApp.

@Test
public void willNotEnableOriginsNotBelongingToTheApp() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(id("some-other-app"), ORIGIN_1.id()));
    assertThat(inventory.originCount(ACTIVE), is(0));
    verify(eventBus, times(2)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Example 2 with EnableOrigin

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

the class OriginsInventoryTest method enablingAnOriginWillReInitiateHealthCheckMonitoring.

@Test
public void enablingAnOriginWillReInitiateHealthCheckMonitoring() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    verify(monitor, times(2)).monitor(singleton(ORIGIN_1));
    assertThat(gaugeValue("generic-app", "app-01"), isValue(0.0));
    verify(eventBus, times(3)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Example 3 with EnableOrigin

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

the class OriginsInventoryTest method logsMessageWhenDisabledOriginWithHealthChecksIsEnabled.

@Test
public void logsMessageWhenDisabledOriginWithHealthChecksIsEnabled() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    assertThat(logger.lastMessage(), is(loggingEvent(INFO, "Origin state change: origin=\"generic-app=app-01\", change=\"DISABLED->INACTIVE\"")));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) Test(org.junit.jupiter.api.Test)

Aggregations

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