-
Notifications
You must be signed in to change notification settings - Fork 3
PR for v1.5.9 #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
PR for v1.5.9 #387
Changes from all commits
29bf895
cc73f28
72b1362
2659e76
f9b11d2
352e444
56861a3
2128ab3
266fd3b
9d95089
52c66ee
2c7e078
d7437a9
8b1a317
199b3db
75d2c34
3fb840b
451248f
7fe76cf
38f0b1b
32bf122
99e28a4
468d9ed
c2b6524
cfe7c9d
209e622
dd15dd7
966cdab
db1fb7d
6277f48
ba49162
2ec76b6
14320b9
6a88554
852c913
166d4d8
d0e2485
bd30b85
99875eb
bf938b2
645916d
8b39503
e0fe876
e6b3603
37cc488
8d2a076
1706b3c
36dae89
257260c
18c04d2
608fe03
50fd465
d7558fd
8265843
c97d8da
d846c02
c52fabe
773a4af
21abd0c
1638a72
e4ad286
373e83e
1e3a97c
0861213
8a4e76f
5b784a6
03a08c4
ec6b4ff
ffca7ed
abb0f11
2190478
04db74f
e734f5b
bb92476
372134c
1750f37
7a8bcfd
d91a79f
0e59de8
22c8707
9db5587
4d394ff
e65f6bf
a0ff5a9
12edcea
0540b60
da415cf
ac87b29
c6ab2c7
41e21c7
f58e826
cfd1909
4ca05b0
b3ddf98
fd39cc7
a13b063
6437612
96bd09f
e411795
1cae587
a7f5c61
6a4e36f
1957897
89196a5
7ca3bc6
4ad11a3
dc951f7
50e715d
697f48f
68cb557
9aa7b39
9811abc
a436eee
2b52195
ef5be62
f6bc10b
2ebba8e
0cd70da
6759261
2f7c9b0
81f0362
bd6799b
3e9c39a
0c6984e
e3b1088
d2e0d9f
f41b727
bb12f09
51fd332
dfd5c99
a30ee95
6f44bab
a0b34e1
dd93ee4
e2caf5d
060886f
5ff1abb
3496ea1
6203bc6
afb95f9
9e431da
58ce37a
5155e37
20f271e
161c126
e1523ab
cd23430
cf6be67
32ee8a2
5d77c3d
c733a17
9063afb
d045373
908f8e9
e8a7cd8
040516c
20bbbaf
5603001
84c1a74
c707f5b
75c3a0e
e56012d
b29ba70
c468659
76409ed
7846421
a0dc647
8eab905
eaebd0e
3a4ef93
d615932
0bb5b08
5257d7e
3adecc8
f0d7d18
1e72f1e
8f72329
5642fd2
8a89926
be88f3a
06a8482
a367539
6512e5c
cde5a30
1d88335
122fbd1
178db8d
7bd46ba
08eb2b5
c2c6133
c603794
d071d89
dbb044a
6b49a84
485e833
0763dcc
7999d1b
aebfdef
6449469
b2a2d97
98d4bb6
f5a79c1
85d5972
c5c8b68
cd1161a
ea3522b
1dd9868
eacd37d
f58b0cd
79540e4
9dd682d
f5a4553
9104fd3
6c1e3f3
d6f643f
0d91b85
d5f98fe
7be3c84
9e8416b
645408f
a1f9975
586ff8b
66904b8
5fad522
394e867
1b3c714
ee9f93d
d830808
ea3cf5c
65f039c
0ba0e9e
ab79696
a427e65
d3e41a1
e6475bf
974848a
c319c66
bce0983
66f9cdb
f45bba5
509f988
b00b2d8
03badab
e80c6dc
eeec3fc
99fc3c2
72be0c7
0123717
dcfcc15
f933fb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * Copyright 2025 Karlsruhe Institute of Technology. | ||
| * | ||
| * 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 edu.kit.datamanager.repo.test.integration; | ||
|
|
||
| import org.hamcrest.Matchers; | ||
| import org.junit.Before; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
| import org.junit.runner.RunWith; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.boot.autoconfigure.domain.EntityScan; | ||
| import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; | ||
| import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
| import org.springframework.boot.test.context.SpringBootTest; | ||
| import org.springframework.context.annotation.ComponentScan; | ||
| import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
| import org.springframework.restdocs.JUnitRestDocumentation; | ||
| import org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener; | ||
| import org.springframework.test.annotation.DirtiesContext; | ||
| import org.springframework.test.context.ActiveProfiles; | ||
| import org.springframework.test.context.TestExecutionListeners; | ||
| import org.springframework.test.context.TestPropertySource; | ||
| import org.springframework.test.context.junit4.SpringRunner; | ||
| import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; | ||
| import org.springframework.test.context.support.DirtiesContextTestExecutionListener; | ||
| import org.springframework.test.context.transaction.TransactionalTestExecutionListener; | ||
| import org.springframework.test.context.web.ServletTestExecutionListener; | ||
| import org.springframework.test.web.servlet.MockMvc; | ||
| import org.springframework.test.web.servlet.setup.MockMvcBuilders; | ||
| import org.springframework.web.context.WebApplicationContext; | ||
|
|
||
| import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; | ||
| import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
| import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; | ||
| import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | ||
| import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
|
||
| /** | ||
| * Test for the Prometheus actuator endpoint. | ||
| * This test checks that the Prometheus endpoint is correctly exposed and that it contains the expected metrics. | ||
| * Also checks that other actuator endpoints are not exposed. | ||
| */ | ||
| @RunWith(SpringRunner.class) | ||
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
| @EntityScan("edu.kit.datamanager") | ||
| @EnableJpaRepositories("edu.kit.datamanager") | ||
| @ComponentScan({"edu.kit.datamanager"}) | ||
| @AutoConfigureMockMvc | ||
|
Comment on lines
+56
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainJUnit 4 runner in a Spring Boot 3.x stack — confirm Vintage engine presence or plan Jupiter migration You’re using JUnit 4 (SpringRunner, @before, @rule). Ensure the build includes junit-vintage-engine, or migrate tests to JUnit Jupiter to align with modern Spring Test support. Based on learnings. Run to confirm dependencies and usage: 🏁 Script executed: #!/bin/bash
# Find explicit JUnit dependencies and engines
rg -nP -C2 '(junit-?vintage|junit-?jupiter|org\.junit\.jupiter|org\.junit\.vintage|junit[:"]\s*4\.)' \
-g '!**/build/**' -g '!**/out/**'
# Spot JUnit4 annotations in tests
rg -nP -C2 'org\.junit\.(Test|Before|Rule)|@RunWith\(SpringRunner\.class\)' src/testLength of output: 10993 🏁 Script executed: #!/bin/bash
# Search for JUnit dependencies in Maven pom.xml
rg -nP '<artifactId>junit' -C1 -g 'pom.xml'
rg -nP 'org\.junit\.vintage|org\.junit\.jupiter' -g 'pom.xml'
# If Gradle build script present, search for junit dependencies
rg -nP 'junit' -g 'build.gradle' -g 'build.gradle.kts'Length of output: 358 Add JUnit Vintage engine or migrate tests to JUnit Jupiter testRuntimeOnly "org.junit.vintage:junit-vintage-engine"or migrate your tests to JUnit Jupiter. 🤖 Prompt for AI Agents |
||
| @TestExecutionListeners(listeners = {ServletTestExecutionListener.class, | ||
| DependencyInjectionTestExecutionListener.class, | ||
| DirtiesContextTestExecutionListener.class, | ||
| TransactionalTestExecutionListener.class, | ||
| WithSecurityContextTestExecutionListener.class}) | ||
| @ActiveProfiles("test") | ||
| @TestPropertySource(properties = {"spring.datasource.url=jdbc:h2:mem:db_prometheus;DB_CLOSE_DELAY=-1;MODE=LEGACY;NON_KEYWORDS=VALUE"}) | ||
| @TestPropertySource(properties = {"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect"}) | ||
| @TestPropertySource(properties = {"spring.jpa.defer-datasource-initialization=true"}) | ||
| @TestPropertySource(properties = {"repo.monitoring.enabled=true"}) | ||
| @TestPropertySource(properties = {"repo.monitoring.serviceName=base_repo_test"}) | ||
| @TestPropertySource(properties = {"management.endpoints.web.exposure.include=prometheus"}) | ||
| @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) | ||
| @AutoConfigureObservability | ||
| public class ActuatorPrometheusTest { | ||
|
|
||
| @Rule | ||
| public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation(); | ||
| private MockMvc mockMvc; | ||
| @Autowired | ||
| private WebApplicationContext context; | ||
|
|
||
| @Before | ||
| public void setUp() { | ||
|
|
||
| // setup mockMvc | ||
| this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context) | ||
| .apply(springSecurity()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testForNotExposedActuators() throws Exception { | ||
| // Check that all other endpoints are not exposed | ||
| this.mockMvc.perform(get("/actuator/beans")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/caches")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/conditions")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/configprops")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/env")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/loggers")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/heapdump")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/threaddump")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/metrics")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/scheduledtasks")).andDo(print()).andExpect(status().isNotFound()); | ||
| this.mockMvc.perform(get("/actuator/mappings")).andDo(print()).andExpect(status().isNotFound()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testActuator() throws Exception { | ||
| // /actuator/prometheus | ||
| this.mockMvc.perform(get("/actuator/prometheus")).andDo(print()).andExpect(status().isOk()) | ||
| .andExpect(content().string(Matchers.containsString("# TYPE base_repo_test_requests_served_total"))) | ||
| .andExpect(content().string(Matchers.containsString("# TYPE base_repo_test_unique_users"))) | ||
| .andExpect(content().string(Matchers.containsString("# TYPE base_repo_test_registered_users"))) | ||
| .andReturn(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update
springBootVersionproperty to match the pluginThe build now applies
org.springframework.boot3.5.6, but thespringBootVersionproperty still advertises 3.2.1. Downstream modules or dependency management imports that consume this property will continue pulling the 3.2.x BOM, creating a version split from the Gradle plugin and the managed dependencies you just upgraded. Please bump the property to 3.5.6 (or remove it if truly unused) so all consumers stay aligned.📝 Committable suggestion
🤖 Prompt for AI Agents