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
01552ecd89
commit
88aae0101f
9 files changed
+78
-1
No files matched your search
@@ -90,4 +90,11 @@ class PublicEndpointsTest {
|
||||
mockMvc.perform(get("/api/public/profiles/library")).andExpect(status().isUnauthorized())
|
||||
.andExpect(jsonPath("$.code").value("INVALID_TICKET"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void versionIsPublic() throws Exception {
|
||||
mockMvc.perform(get("/api/version"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.commit").isString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package core_service.modules.version.api;
|
||||
|
||||
import core_service.modules.version.api.dto.VersionDto;
|
||||
import core_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