Refactor code and fix leader election tests

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
This commit is contained in:
faizanahmad055
2026-05-11 20:48:54 +02:00
parent 199587dd42
commit 96ac8d1daf
6 changed files with 175 additions and 70 deletions

View File

@@ -26,9 +26,14 @@ func TestGetImageRepository(t *testing.T) {
expected: "ghcr.io/stakater/reloader",
},
{
name: "image with digest (not fully supported)",
name: "image with digest",
image: "nginx@sha256:abc123",
expected: "nginx@sha256",
expected: "nginx",
},
{
name: "full image with digest",
image: "ghcr.io/stakater/reloader@sha256:deadbeef",
expected: "ghcr.io/stakater/reloader",
},
{
name: "simple image name",
@@ -88,6 +93,16 @@ func TestGetImageTag(t *testing.T) {
image: "myimage:sha-abc123",
expected: "sha-abc123",
},
{
name: "image with digest",
image: "nginx@sha256:abc123",
expected: "sha256:abc123",
},
{
name: "full image with digest",
image: "ghcr.io/stakater/reloader@sha256:deadbeef",
expected: "sha256:deadbeef",
},
}
for _, tt := range tests {