Search in sources :

Example 1 with InMemoryLoadBalancerStore

use of com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore in project titus-control-plane by Netflix.

the class DefaultLoadBalancerJobValidatorTest method setUp.

@Before
public void setUp() throws Exception {
    jobOperations = mock(V3JobOperations.class);
    loadBalancerStore = new InMemoryLoadBalancerStore();
    loadBalancerValidationConfiguration = mock(LoadBalancerValidationConfiguration.class);
    loadBalancerValidator = new DefaultLoadBalancerJobValidator(jobOperations, loadBalancerStore, loadBalancerValidationConfiguration);
}
Also used : V3JobOperations(com.netflix.titus.api.jobmanager.service.V3JobOperations) InMemoryLoadBalancerStore(com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore) Before(org.junit.Before)

Example 2 with InMemoryLoadBalancerStore

use of com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore in project titus-control-plane by Netflix.

the class DefaultLoadBalancerReconcilerTest method setUp.

@Before
public void setUp() throws Exception {
    loadBalancerId = UUID.randomUUID().toString();
    jobId = UUID.randomUUID().toString();
    delayMs = 60_000L;
    /* 1 min */
    store = new InMemoryLoadBalancerStore();
    connector = mock(LoadBalancerConnector.class);
    when(connector.getLoadBalancer(loadBalancerId)).thenReturn(Single.just(new LoadBalancer(loadBalancerId, LoadBalancer.State.ACTIVE, Collections.emptySet())));
    v3JobOperations = mock(V3JobOperations.class);
    testScheduler = Schedulers.test();
    reconciliationCount = new AtomicLong(0);
    reconciler = new DefaultLoadBalancerReconciler(mockConfigWithDelay(delayMs), store, connector, new LoadBalancerJobOperations(v3JobOperations), () -> reconciliationCount.incrementAndGet(), new NoopRegistry(), testScheduler);
    subscriber = reconciler.events().test();
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) LoadBalancerConnector(com.netflix.titus.api.connector.cloud.LoadBalancerConnector) InMemoryLoadBalancerStore(com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore) V3JobOperations(com.netflix.titus.api.jobmanager.service.V3JobOperations) NoopRegistry(com.netflix.spectator.api.NoopRegistry) JobLoadBalancer(com.netflix.titus.api.loadbalancer.model.JobLoadBalancer) LoadBalancer(com.netflix.titus.api.connector.cloud.LoadBalancer) Before(org.junit.Before)

Example 3 with InMemoryLoadBalancerStore

use of com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore in project titus-control-plane by Netflix.

the class DefaultLoadBalancerServiceTest method setUp.

@Before
public void setUp() throws Exception {
    runtime = TitusRuntimes.internal();
    client = mock(LoadBalancerConnector.class);
    loadBalancerStore = new InMemoryLoadBalancerStore();
    reconciler = mock(LoadBalancerReconciler.class);
    reconcilerEvents = PublishSubject.create();
    when(reconciler.events()).thenReturn(reconcilerEvents.toSerialized());
    v3JobOperations = mock(V3JobOperations.class);
    loadBalancerJobOperations = new LoadBalancerJobOperations(v3JobOperations);
    LoadBalancerValidationConfiguration validationConfiguration = LoadBalancerTests.mockValidationConfig(30);
    validator = new DefaultLoadBalancerJobValidator(v3JobOperations, loadBalancerStore, validationConfiguration);
    testScheduler = Schedulers.test();
}
Also used : LoadBalancerValidationConfiguration(com.netflix.titus.api.loadbalancer.model.sanitizer.LoadBalancerValidationConfiguration) LoadBalancerConnector(com.netflix.titus.api.connector.cloud.LoadBalancerConnector) InMemoryLoadBalancerStore(com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore) V3JobOperations(com.netflix.titus.api.jobmanager.service.V3JobOperations) DefaultLoadBalancerJobValidator(com.netflix.titus.api.loadbalancer.model.sanitizer.DefaultLoadBalancerJobValidator) Before(org.junit.Before)

Example 4 with InMemoryLoadBalancerStore

use of com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore in project titus-control-plane by Netflix.

the class LoadBalancerTests method getMockLoadBalancerService.

public static LoadBalancerService getMockLoadBalancerService() {
    final TitusRuntime runtime = TitusRuntimes.internal();
    final LoadBalancerConfiguration loadBalancerConfig = mockConfiguration(5_000);
    final LoadBalancerConnector connector = mock(LoadBalancerConnector.class);
    final V3JobOperations v3JobOperations = mock(V3JobOperations.class);
    when(v3JobOperations.observeJobs()).thenReturn(PublishSubject.create());
    final LoadBalancerJobOperations loadBalancerJobOperations = new LoadBalancerJobOperations(v3JobOperations);
    final LoadBalancerReconciler reconciler = mock(LoadBalancerReconciler.class);
    when(reconciler.events()).thenReturn(PublishSubject.create());
    final LoadBalancerStore loadBalancerStore = new InMemoryLoadBalancerStore();
    final LoadBalancerJobValidator validator = new NoOpLoadBalancerJobValidator();
    final TestScheduler testScheduler = Schedulers.test();
    return new DefaultLoadBalancerService(runtime, loadBalancerConfig, connector, loadBalancerStore, loadBalancerJobOperations, reconciler, validator, testScheduler);
}
Also used : NoOpLoadBalancerJobValidator(com.netflix.titus.api.loadbalancer.model.sanitizer.NoOpLoadBalancerJobValidator) LoadBalancerJobValidator(com.netflix.titus.api.loadbalancer.model.sanitizer.LoadBalancerJobValidator) LoadBalancerConnector(com.netflix.titus.api.connector.cloud.LoadBalancerConnector) V3JobOperations(com.netflix.titus.api.jobmanager.service.V3JobOperations) InMemoryLoadBalancerStore(com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore) NoOpLoadBalancerJobValidator(com.netflix.titus.api.loadbalancer.model.sanitizer.NoOpLoadBalancerJobValidator) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) TestScheduler(rx.schedulers.TestScheduler) LoadBalancerStore(com.netflix.titus.api.loadbalancer.store.LoadBalancerStore) InMemoryLoadBalancerStore(com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore)

Aggregations

V3JobOperations (com.netflix.titus.api.jobmanager.service.V3JobOperations)4 InMemoryLoadBalancerStore (com.netflix.titus.runtime.store.v3.memory.InMemoryLoadBalancerStore)4 LoadBalancerConnector (com.netflix.titus.api.connector.cloud.LoadBalancerConnector)3 Before (org.junit.Before)3 NoopRegistry (com.netflix.spectator.api.NoopRegistry)1 LoadBalancer (com.netflix.titus.api.connector.cloud.LoadBalancer)1 JobLoadBalancer (com.netflix.titus.api.loadbalancer.model.JobLoadBalancer)1 DefaultLoadBalancerJobValidator (com.netflix.titus.api.loadbalancer.model.sanitizer.DefaultLoadBalancerJobValidator)1 LoadBalancerJobValidator (com.netflix.titus.api.loadbalancer.model.sanitizer.LoadBalancerJobValidator)1 LoadBalancerValidationConfiguration (com.netflix.titus.api.loadbalancer.model.sanitizer.LoadBalancerValidationConfiguration)1 NoOpLoadBalancerJobValidator (com.netflix.titus.api.loadbalancer.model.sanitizer.NoOpLoadBalancerJobValidator)1 LoadBalancerStore (com.netflix.titus.api.loadbalancer.store.LoadBalancerStore)1 TitusRuntime (com.netflix.titus.common.runtime.TitusRuntime)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 TestScheduler (rx.schedulers.TestScheduler)1