Skip to content

Commit

Permalink
add test in static SD
Browse files Browse the repository at this point in the history
Fixes #533
  • Loading branch information
aureamunoz committed Jun 1, 2023
1 parent fb99fe3 commit 2afe61d
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ void setUp() {
TestConfigProvider.addServiceConfig("secured-service", null, "static",
null, Map.of("address-list", "localhost:443, localhost"));

TestConfigProvider.addServiceConfig("scheme-service", null, "static",
null, Map.of("address-list", "http://localhost:8080, https://localhost:8081"));

stork = StorkTestUtils.getNewStorkInstance();
}

Expand All @@ -52,6 +55,18 @@ void testSecureDetection() {
assertThat(instances.get(0).isSecure()).isTrue();
}

@Test
void testSchemeDetection() {
List<ServiceInstance> instances = stork.getService("scheme-service").getInstances().await()
.atMost(Duration.ofSeconds(5));

assertThat(instances).hasSize(2);
assertThat(instances.stream().map(ServiceInstance::getHost)).containsExactlyInAnyOrder("localhost",
"localhost");
assertThat(instances.stream().map(ServiceInstance::getPort)).containsExactlyInAnyOrder(8080,
8081);
}

@Test
void shouldGetAllServiceInstances() {
List<ServiceInstance> serviceInstances = stork.getService("first-service")
Expand Down

0 comments on commit 2afe61d

Please sign in to comment.