feat(master): suggest newer version tags for third-party images (#11) (#31)
Docker Build / docker (push) Successful in 45s

This commit was merged in pull request #31.
This commit is contained in:
2026-10-13 10:18:53 +00:00
parent 850a670446
commit f6446be711
26 changed files with 1090 additions and 48 deletions
+22
View File
@@ -211,3 +211,25 @@ func TestGroupServices(t *testing.T) {
assert.Equal(t, "because", groups[0].Services[0].AutoBlocked)
})
}
func TestNewerTag(t *testing.T) {
removed := time.Now()
tests := []struct {
name string
svc model.Service
want string
}{
{"newer", model.Service{ActualRef: "gitea/gitea:1.27.3", NewerRef: "gitea/gitea:1.28.0"}, "1.28.0"},
{"bare image follows latest", model.Service{ActualRef: "gitea/gitea", NewerRef: "gitea/gitea:1.28.0"}, ""},
{"stale after the tag changed", model.Service{ActualRef: "gitea/gitea:1.28.0", NewerRef: "gitea/gitea:1.28.0"}, ""},
{"stale after the tag moved past it", model.Service{ActualRef: "gitea/gitea:1.29.0", NewerRef: "gitea/gitea:1.28.0"}, ""},
{"other repo", model.Service{ActualRef: "redis:7.2.4", NewerRef: "bitnami/redis:7.2.5"}, ""},
{"removed", model.Service{ActualRef: "gitea/gitea:1.27.3", NewerRef: "gitea/gitea:1.28.0", RemovedAt: &removed}, ""},
{"empty", model.Service{ActualRef: "gitea/gitea:1.27.3"}, ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.want, newerTag(tt.svc))
})
}
}