Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 55a3034

Browse files
authored
Add actuator props to stream on deployment (#5141)
* Add actuator props to stream on deployment Fixes #4753
1 parent fea8fe9 commit 55a3034

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

spring-cloud-dataflow-server-core/src/main/resources/META-INF/application-stream-common-properties-defaults.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ common:
1111

1212
# Tags required to use the Wavefront Spring Boot tile.
1313
application: ${spring.cloud.dataflow.stream.name:unknown}-${spring.cloud.dataflow.stream.app.label:unknown}-${spring.cloud.dataflow.stream.app.type:unknown}
14+
endpoints:
15+
web:
16+
exposure:
17+
include: health,info,bindings
1418

1519
# Properties required for Wavefront Tracing.
1620
wavefront.application.name: ${spring.cloud.dataflow.stream.name:unknown}
@@ -30,4 +34,3 @@ cloudfoundry:
3034
space.name: ${vcap.application.space_name:unknown}
3135
application.id: ${vcap.application.application_id:unknown}
3236
application.version: ${vcap.application.application_version:unknown}
33-

spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/service/impl/DefaultStreamServiceIntegrationTests.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.HashMap;
2525
import java.util.Map;
2626

27+
import org.assertj.core.api.InstanceOfAssertFactories;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.Test;
@@ -295,6 +296,43 @@ public void testUpdateStreamDslOnRollback() throws IOException {
295296
.isEqualTo("time --trigger.fixed-delay=100 | log --log.level=DEBUG");
296297
}
297298

299+
@Test
300+
public void testDeployHasActuatorProps() throws IOException {
301+
302+
when(skipperClient.status(eq("ticktock"))).thenThrow(new ReleaseNotFoundException(""));
303+
304+
Map<String, String> deploymentProperties = createSkipperDeploymentProperties();
305+
streamService.deployStream("ticktock", deploymentProperties);
306+
307+
ArgumentCaptor<UploadRequest> uploadRequestCaptor = ArgumentCaptor.forClass(UploadRequest.class);
308+
verify(skipperClient).upload(uploadRequestCaptor.capture());
309+
310+
Package pkg = SkipperPackageUtils.loadPackageFromBytes(uploadRequestCaptor);
311+
312+
// ExpectedYaml will have version: 1.2.0.RELEASE and not 1.1.1.RELEASE
313+
Package logPackage = null;
314+
for (Package subpkg : pkg.getDependencies()) {
315+
if (subpkg.getMetadata().getName().equals("log")) {
316+
logPackage = subpkg;
317+
}
318+
}
319+
assertThat(logPackage).isNotNull();
320+
String actualYaml = logPackage.getConfigValues().getRaw();
321+
322+
DumperOptions dumperOptions = new DumperOptions();
323+
dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
324+
dumperOptions.setPrettyFlow(true);
325+
Yaml yaml = new Yaml(new SafeConstructor(), new Representer(dumperOptions), dumperOptions);
326+
327+
Object actualYamlLoaded = yaml.load(actualYaml);
328+
329+
assertThat(actualYamlLoaded).isInstanceOf(Map.class)
330+
.asInstanceOf(InstanceOfAssertFactories.MAP)
331+
.extractingByKey("spec", InstanceOfAssertFactories.MAP)
332+
.extractingByKey("applicationProperties", InstanceOfAssertFactories.MAP)
333+
.containsEntry("management.endpoints.web.exposure.include", "health,info,bindings");
334+
}
335+
298336
@Test
299337
public void testStreamInfo() throws IOException {
300338

spring-cloud-dataflow-server-core/src/test/resources/org/springframework/cloud/dataflow/server/service/impl/DefaultStreamServiceIntegrationTests-install.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"spec":
44
"resource": "maven://org.springframework.cloud.stream.app:log-sink-rabbit:jar"
55
"applicationProperties":
6+
"management.endpoints.web.exposure.include": "health,info,bindings"
67
"spring.cloud.dataflow.stream.app.label": "log"
78
"spring.cloud.dataflow.stream.name": "ticktock"
89
"spring.cloud.dataflow.stream.app.type": "sink"

0 commit comments

Comments
 (0)