feat(version): answer the build commit and time
Build, Test & Push Core Service / quality-check (push) Successful in 57s
Build, Test & Push Core Service / docker (push) Successful in 1m20s

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:
lobo committed 2026-09-27 10:27:01 +02:00
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);
}
}