mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix bug hidden on CI and make ci failed if tests failure (#29254)
The tests on migration tests failed but CI reports successfully https://github.com/go-gitea/gitea/actions/runs/7364373807/job/20044685969#step:8:141 This PR will fix the bug on migration v283 and also the CI hidden behaviour. The reason is on the Makefile `GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(MIGRATE_TEST_PACKAGES)` will return the error exit code. But `for pkg in $(shell $(GO) list code.gitea.io/gitea/models/migrations/...); do \ GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg; \ done` will not work. This also fix #29602
This commit is contained in:
@@ -20,20 +20,20 @@ func Test_UpdateBadgeColName(t *testing.T) {
|
||||
}
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(BadgeUnique), new(Badge))
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(Badge))
|
||||
defer deferable()
|
||||
if x == nil || t.Failed() {
|
||||
return
|
||||
}
|
||||
|
||||
oldBadges := []Badge{
|
||||
{ID: 1, Description: "Test Badge 1", ImageURL: "https://example.com/badge1.png"},
|
||||
{ID: 2, Description: "Test Badge 2", ImageURL: "https://example.com/badge2.png"},
|
||||
{ID: 3, Description: "Test Badge 3", ImageURL: "https://example.com/badge3.png"},
|
||||
oldBadges := []*Badge{
|
||||
{Description: "Test Badge 1", ImageURL: "https://example.com/badge1.png"},
|
||||
{Description: "Test Badge 2", ImageURL: "https://example.com/badge2.png"},
|
||||
{Description: "Test Badge 3", ImageURL: "https://example.com/badge3.png"},
|
||||
}
|
||||
|
||||
for _, badge := range oldBadges {
|
||||
_, err := x.Insert(&badge)
|
||||
_, err := x.Insert(badge)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func Test_UpdateBadgeColName(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, e := range oldBadges {
|
||||
got := got[i]
|
||||
got := got[i+1] // 1 is in the badge.yml
|
||||
assert.Equal(t, e.ID, got.ID)
|
||||
assert.Equal(t, fmt.Sprintf("%d", e.ID), got.Slug)
|
||||
}
|
||||
|
Reference in New Issue
Block a user