Public Access
feat(version): answer the build commit and time
GET /api/version is public. CI passes GIT_SHA and BUILD_TIME as Docker build args; a local build answers dev.
This commit is contained in:
1 parent
4ec47f1b2c
commit
a1763addce
9 files changed
+76
No files matched your search
@@ -42,4 +42,11 @@ class PublicEndpointsTest extends AbstractIntegrationTest {
|
||||
int status = mockMvc.perform(get("/actuator/prometheus")).andReturn().getResponse().getStatus();
|
||||
assertTrue(Set.of(401, 403).contains(status), "/actuator/prometheus answered " + status);
|
||||
}
|
||||
|
||||
@Test
|
||||
void versionIsPublic() throws Exception {
|
||||
mockMvc.perform(get("/api/version"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.commit").isString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package auth_service.modules.version.api;
|
||||
|
||||
import auth_service.modules.version.api.dto.VersionDto;
|
||||
import auth_service.shared.test.AbstractUnitTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class VersionControllerTest extends AbstractUnitTest {
|
||||
|
||||
@Test
|
||||
void answersTheBuildOfTheImage() {
|
||||
VersionDto version = new VersionController("4ec47f1aa0b1", "2026-09-27T08:05:00Z").getVersion().getBody();
|
||||
|
||||
assertEquals(new VersionDto("4ec47f1aa0b1", "2026-09-27T08:05:00Z"), version);
|
||||
}
|
||||
|
||||
@Test
|
||||
void emptyBuildArgsCountAsLocalBuild() {
|
||||
VersionDto version = new VersionController("", "").getVersion().getBody();
|
||||
|
||||
assertEquals(new VersionDto("dev", null), version);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user