forked from spinnaker/kork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(dependencies): clean up spectator dependencies - change scope of spectator-web-spring dependencies from api to implementation since consumers of neither kork-stackdriver nor kork-web need it at compile time, and exclude transitives to keep spectator-web-spring's spring(boot) dependencies from overriding what we've defined elsewhere. Add a test to ensure that the metrics endpoint from spectator-web-spring is really available. - exclude transitive dependencies of spectator-ext-aws in kork-aws for a similar reason -- to keep spectator-ext-aws' version of the aws sdk (and the aws sdk's transitives) from giving us newer versions of the sdk, jackson and kotlin than consumers are ready for. This paves the way to upgrade to spectator 1.0.5 where a newer version of the spring(boot) dependencies that spectator-web-spring brings in cause problems. See Netflix/spectator#920 for background. * chore(dependences): use version 1.0.6 of spectator to stay up to date
- Loading branch information
1 parent
48bf8b0
commit 583b479
Showing
6 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...c/test/groovy/com/netflix/spinnaker/kork/web/config/MetricsEndpointConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2021 Salesforce, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.kork.web.config; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.netflix.spinnaker.config.MetricsEndpointConfiguration; | ||
import java.net.URI; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.web.client.TestRestTemplate; | ||
import org.springframework.boot.web.server.LocalServerPort; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.web.util.UriComponentsBuilder; | ||
|
||
@SpringBootTest( | ||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, | ||
classes = { | ||
MetricsEndpointConfigurationTest.TestConfiguration.class, | ||
MetricsEndpointConfiguration.class | ||
}) | ||
@TestPropertySource(properties = {"spectator.web-endpoint.enabled = true"}) | ||
public class MetricsEndpointConfigurationTest { | ||
|
||
@LocalServerPort int port; | ||
|
||
@Autowired TestRestTemplate restTemplate; | ||
|
||
@Test | ||
public void spectatorMetricsAccess() { | ||
URI uri = | ||
UriComponentsBuilder.fromHttpUrl("http://localhost/spectator/metrics") | ||
.port(port) | ||
.build() | ||
.toUri(); | ||
|
||
ResponseEntity<String> entity = restTemplate.getForEntity(uri, String.class); | ||
assertEquals(HttpStatus.OK, entity.getStatusCode()); | ||
} | ||
|
||
@SpringBootApplication | ||
public static class TestConfiguration {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters