Skip to content

Commit e3ff968

Browse files
committed
fix test cases, update changelog
1 parent 850a4c3 commit e3ff968

File tree

5 files changed

+48
-36
lines changed

5 files changed

+48
-36
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
44

55
## 2.5.1 (05/19/2020)
66
- [ISSUE-209](https://github.com/SourceLabOrg/kafka-webview/issues/209) Expose HealthCheck and App Info endpoints without requiring authentication.
7+
- Docker image now exposes port 9090 for Actuator end points.
78
- [ISSUE-161](https://github.com/SourceLabOrg/kafka-webview/issues/161) Add dedicated 'Apply' and 'Reset' button to Partition and Record Filters.
89
- [ISSUE-212](https://github.com/SourceLabOrg/kafka-webview/issues/212) Bugfix for partition filters being persisted when toggled on from `Stream` page.
910

Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ RUN echo "${WEBVIEW_SHA1} /tmp/kafka-webview-ui-bin.zip" | sha1sum -c - && \
3232
# Create volume to persist data
3333
VOLUME ${WEBVIEW_HOME}/data
3434

35-
# Expose port
35+
# Expose WebUI Port
3636
EXPOSE 8080
3737

38+
# Expose Acuator Port for health checks.
39+
EXPOSE 9090
40+
3841
# What to run when the container starts
3942
ENTRYPOINT [ "/app/start.sh" ]

kafka-webview-ui/src/assembly/distribution/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ server:
66
## User login session timeout after 1 hour (3600 seconds)
77
timeout: 3600
88

9+
# Spring Actuator Port
10+
management:
11+
server:
12+
port: ${ACTUATOR_PORT:9090}
913

1014
## Various App Configs
1115
app:

kafka-webview-ui/src/main/resources/config/base.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spring:
4848
# Spring Actuator - global
4949
management:
5050
server:
51-
port: 9090
51+
port: ${ACUATOR_PORT:9090}
5252
endpoints:
5353
web:
5454
exposure:

kafka-webview-ui/src/test/java/org/sourcelab/kafka/webview/ui/controller/stream/StreamControllerTest.java

+38-34
Original file line numberDiff line numberDiff line change
@@ -122,41 +122,41 @@ public void shouldReceiveAMessageFromTheServer() throws Exception {
122122
final String expectedSessionId = "MYSESSIONID";
123123
final String topicName = "TestTopic" + System.currentTimeMillis();
124124

125-
// Sanity test, no active consumers
126-
Assert.assertEquals("Should have no active consumers", 0, webSocketConsumersManager.countActiveConsumers());
127-
128-
// Create a topic
129-
sharedKafkaTestResource
130-
.getKafkaTestUtils()
131-
.createTopic(topicName, 2, (short) 1);
132-
133-
// Create cluster
134-
final Cluster cluster = clusterTestTools
135-
.createCluster("TestCluster", sharedKafkaTestResource.getKafkaConnectString());
136-
137-
// Create view
138-
final View view = viewTestTools
139-
.createViewWithCluster("TestView", cluster);
140-
141-
// Sanity test, no enforced partitions
142-
assertEquals("Partitions Property should be empty string", "", view.getPartitions());
143-
144-
final ConsumeRequest consumeRequest = new ConsumeRequest();
145-
consumeRequest.setAction("head");
146-
consumeRequest.setPartitions("0,1");
147-
consumeRequest.setFilters(new ArrayList<>());
148-
consumeRequest.setResultsPerPartition(10);
149-
150-
final SimpMessageHeaderAccessor mockHeaderAccessor = mock(SimpMessageHeaderAccessor.class);
151-
final Authentication mockPrincipal = mock(Authentication.class);
152-
when(mockHeaderAccessor.getUser())
153-
.thenReturn(mockPrincipal);
154-
when(mockPrincipal.getPrincipal())
155-
.thenReturn(nonAdminUserDetails);
156-
when(mockHeaderAccessor.getSessionId())
157-
.thenReturn(expectedSessionId);
158-
159125
try {
126+
// Sanity test, no active consumers
127+
Assert.assertEquals("Should have no active consumers", 0, webSocketConsumersManager.countActiveConsumers());
128+
129+
// Create a topic
130+
sharedKafkaTestResource
131+
.getKafkaTestUtils()
132+
.createTopic(topicName, 2, (short) 1);
133+
134+
// Create cluster
135+
final Cluster cluster = clusterTestTools
136+
.createCluster("TestCluster", sharedKafkaTestResource.getKafkaConnectString());
137+
138+
// Create view
139+
final View view = viewTestTools
140+
.createViewWithCluster("TestView", cluster);
141+
142+
// Sanity test, no enforced partitions
143+
assertEquals("Partitions Property should be empty string", "", view.getPartitions());
144+
145+
final ConsumeRequest consumeRequest = new ConsumeRequest();
146+
consumeRequest.setAction("head");
147+
consumeRequest.setPartitions("0,1");
148+
consumeRequest.setFilters(new ArrayList<>());
149+
consumeRequest.setResultsPerPartition(10);
150+
151+
final SimpMessageHeaderAccessor mockHeaderAccessor = mock(SimpMessageHeaderAccessor.class);
152+
final Authentication mockPrincipal = mock(Authentication.class);
153+
when(mockHeaderAccessor.getUser())
154+
.thenReturn(mockPrincipal);
155+
when(mockPrincipal.getPrincipal())
156+
.thenReturn(nonAdminUserDetails);
157+
when(mockHeaderAccessor.getSessionId())
158+
.thenReturn(expectedSessionId);
159+
160160
final String result = streamController.newConsumer(
161161
view.getId(),
162162
consumeRequest,
@@ -174,6 +174,10 @@ public void shouldReceiveAMessageFromTheServer() throws Exception {
174174
} finally {
175175
// Cleanup, disconnect websocket consumers
176176
webSocketConsumersManager.removeConsumersForSessionId(expectedSessionId);
177+
178+
// Remove created data.
179+
viewTestTools.deleteAllViews();
180+
clusterTestTools.deleteAllClusters();
177181
}
178182
}
179183
}

0 commit comments

Comments
 (0)