feat(master): suggest newer version tags for third-party images (#11)
This commit is contained in:
@@ -219,3 +219,38 @@ func TestOverview_ShowsFollowsNoTagAndPollFailedBadges(t *testing.T) {
|
||||
assert.Equal(t, 1, strings.Count(body, "Poll failed"), path)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServicePage_VersionPickerAppendsNewerTagBeyondLimit(t *testing.T) {
|
||||
srv, store, _, _, _ := newTestEnv(t)
|
||||
store.services[0].ImageRepo = sluskRepo
|
||||
store.services[0].NewerRef = sluskRepo + ":1.5.0"
|
||||
for i := int64(1); i <= 12; i++ {
|
||||
store.versions = append(store.versions, model.ImageVersion{ID: i, Repo: sluskRepo, Tag: "t", Digest: "sha256:d", Source: "poll"})
|
||||
}
|
||||
store.versions = append(store.versions, model.ImageVersion{ID: 99, Repo: sluskRepo, Tag: "1.5.0", Source: "tags"})
|
||||
|
||||
_, body := get(t, srv, "/services/1")
|
||||
|
||||
assert.Equal(t, 11, strings.Count(body, `name="version"`), "the ten recent versions and the newer tag")
|
||||
assert.Contains(t, body, `<input type="hidden" name="version" value="99">`)
|
||||
assert.Contains(t, body, "<th>Newer tag</th>")
|
||||
}
|
||||
|
||||
func TestServicePage_NewerTagAlreadyListedIsNotAppendedTwice(t *testing.T) {
|
||||
srv, store, _, _, _ := newTestEnv(t)
|
||||
store.services[0].ImageRepo = sluskRepo
|
||||
store.services[0].NewerRef = sluskRepo + ":1.5.0"
|
||||
store.versions = []model.ImageVersion{{ID: 31, Repo: sluskRepo, Tag: "1.5.0", Source: "tags"}}
|
||||
|
||||
_, body := get(t, srv, "/services/1")
|
||||
|
||||
assert.Equal(t, 1, strings.Count(body, `name="version"`))
|
||||
}
|
||||
|
||||
func TestServicePage_NoNewerTagRowWithoutSuggestion(t *testing.T) {
|
||||
srv, _, _, _, _ := newTestEnv(t)
|
||||
|
||||
_, body := get(t, srv, "/services/1")
|
||||
|
||||
assert.NotContains(t, body, "Newer tag")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user