blob: 6c78eb85ee6e2737cbd553ae63f8c72ebd9f40ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.tenant;
import com.yahoo.config.model.api.ApplicationClusterEndpoint;
import com.yahoo.config.model.api.ContainerEndpoint;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.path.Path;
import com.yahoo.vespa.curator.mock.MockCurator;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ContainerEndpointsCacheTest {
@Test
public void readWriteFromCache() {
final var cache = new ContainerEndpointsCache(Path.createRoot(), new MockCurator());
final var endpoints = List.of(
new ContainerEndpoint("the-cluster-1", ApplicationClusterEndpoint.Scope.global, List.of("a", "b", "c"))
);
cache.write(ApplicationId.defaultId(), endpoints);
final var deserialized = cache.read(ApplicationId.defaultId());
assertEquals(endpoints, deserialized);
}
@Test
public void readingNonExistingEntry() {
final var cache = new ContainerEndpointsCache(Path.createRoot(), new MockCurator());
final var endpoints = cache.read(ApplicationId.defaultId());
assertTrue(endpoints.isEmpty());
}
}
|