Skip to content

Commit ae28239

Browse files
committed
Fix lint and fix wrong migrations
1 parent 65dbaa5 commit ae28239

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

models/migrations/migrations.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"code.gitea.io/gitea/models/migrations/v1_23"
2626
"code.gitea.io/gitea/models/migrations/v1_24"
2727
"code.gitea.io/gitea/models/migrations/v1_25"
28+
"code.gitea.io/gitea/models/migrations/v1_26"
2829
"code.gitea.io/gitea/models/migrations/v1_6"
2930
"code.gitea.io/gitea/models/migrations/v1_7"
3031
"code.gitea.io/gitea/models/migrations/v1_8"
@@ -394,8 +395,10 @@ func prepareMigrationTasks() []*migration {
394395
// Gitea 1.24.0 ends at database version 321
395396
newMigration(321, "Use LONGTEXT for some columns and fix review_state.updated_files column", v1_25.UseLongTextInSomeColumnsAndFixBugs),
396397
newMigration(322, "Extend comment tree_path length limit", v1_25.ExtendCommentTreePathLength),
397-
newMigration(323, "Add support for actions concurrency", v1_25.AddActionsConcurrency),
398-
newMigration(324, "Add new table project_workflow", v1_25.AddProjectWorkflow),
398+
399+
// Gitea 1.25.0 ends at database version 323
400+
newMigration(323, "Add support for actions concurrency", v1_26.AddActionsConcurrency),
401+
newMigration(324, "Add new table project_workflow", v1_26.AddProjectWorkflow),
399402
}
400403
return preparedMigrations
401404
}

models/migrations/v1_25/v323.go renamed to models/migrations/v1_26/v323.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
package v1_25
4+
package v1_26
55

66
import (
77
"xorm.io/xorm"

models/migrations/v1_25/v324.go renamed to models/migrations/v1_26/v324.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
package v1_25
4+
package v1_26
55

66
import (
77
"code.gitea.io/gitea/modules/timeutil"

models/project/workflows_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package project
55

66
import (
7-
"fmt"
7+
"strconv"
88
"testing"
99

1010
"code.gitea.io/gitea/models/db"
@@ -115,7 +115,7 @@ func TestCreateWorkflow(t *testing.T) {
115115
WorkflowActions: []WorkflowAction{
116116
{
117117
Type: WorkflowActionTypeColumn,
118-
Value: fmt.Sprintf("%d", column.ID),
118+
Value: strconv.FormatInt(column.ID, 10),
119119
},
120120
},
121121
Enabled: true,

tests/integration/project_workflow_test.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
package integration
55

66
import (
7-
"encoding/json"
87
"fmt"
98
"net/http"
9+
"strconv"
1010
"strings"
1111
"testing"
1212

@@ -15,6 +15,7 @@ import (
1515
repo_model "code.gitea.io/gitea/models/repo"
1616
"code.gitea.io/gitea/models/unittest"
1717
user_model "code.gitea.io/gitea/models/user"
18+
"code.gitea.io/gitea/modules/json"
1819
"code.gitea.io/gitea/tests"
1920

2021
"github.com/stretchr/testify/assert"
@@ -64,7 +65,7 @@ func TestProjectWorkflowsPage(t *testing.T) {
6465
WorkflowActions: []project_model.WorkflowAction{
6566
{
6667
Type: project_model.WorkflowActionTypeColumn,
67-
Value: fmt.Sprintf("%d", column1.ID),
68+
Value: strconv.FormatInt(column1.ID, 10),
6869
},
6970
},
7071
Enabled: true,
@@ -84,7 +85,7 @@ func TestProjectWorkflowsPage(t *testing.T) {
8485
WorkflowActions: []project_model.WorkflowAction{
8586
{
8687
Type: project_model.WorkflowActionTypeColumn,
87-
Value: fmt.Sprintf("%d", column2.ID),
88+
Value: strconv.FormatInt(column2.ID, 10),
8889
},
8990
},
9091
Enabled: false, // Disabled workflow
@@ -101,20 +102,20 @@ func TestProjectWorkflowsPage(t *testing.T) {
101102
htmlDoc := NewHTMLParser(t, resp.Body)
102103

103104
// Verify the main workflow container exists
104-
assert.True(t, htmlDoc.Find("#project-workflows").Length() > 0, "Main workflow container should exist")
105+
assert.Positive(t, htmlDoc.Find("#project-workflows").Length(), "Main workflow container should exist")
105106

106107
// Verify data attributes are set correctly
107108
workflowDiv := htmlDoc.Find("#project-workflows")
108-
assert.True(t, workflowDiv.Length() > 0, "Workflow div should exist")
109+
assert.Positive(t, workflowDiv.Length(), "Workflow div should exist")
109110

110111
// Check that locale data attributes exist
111-
assert.True(t, workflowDiv.AttrOr("data-locale-default-workflows", "") != "", "data-locale-default-workflows should be set")
112-
assert.True(t, workflowDiv.AttrOr("data-locale-when", "") != "", "data-locale-when should be set")
113-
assert.True(t, workflowDiv.AttrOr("data-locale-actions", "") != "", "data-locale-actions should be set")
114-
assert.True(t, workflowDiv.AttrOr("data-locale-filters", "") != "", "data-locale-filters should be set")
115-
assert.True(t, workflowDiv.AttrOr("data-locale-close-issue", "") != "", "data-locale-close-issue should be set")
116-
assert.True(t, workflowDiv.AttrOr("data-locale-reopen-issue", "") != "", "data-locale-reopen-issue should be set")
117-
assert.True(t, workflowDiv.AttrOr("data-locale-issues-and-pull-requests", "") != "", "data-locale-issues-and-pull-requests should be set")
112+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-default-workflows", ""), "data-locale-default-workflows should be set")
113+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-when", ""), "data-locale-when should be set")
114+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-actions", ""), "data-locale-actions should be set")
115+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-filters", ""), "data-locale-filters should be set")
116+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-close-issue", ""), "data-locale-close-issue should be set")
117+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-reopen-issue", ""), "data-locale-reopen-issue should be set")
118+
assert.NotEmpty(t, workflowDiv.AttrOr("data-locale-issues-and-pull-requests", ""), "data-locale-issues-and-pull-requests should be set")
118119

119120
// Verify project link is set
120121
projectLink := workflowDiv.AttrOr("data-project-link", "")
@@ -173,7 +174,7 @@ func TestProjectWorkflowCreate(t *testing.T) {
173174
string(project_model.WorkflowFilterTypeIssueType): "issue",
174175
},
175176
"actions": map[string]any{
176-
string(project_model.WorkflowActionTypeColumn): fmt.Sprintf("%d", column.ID),
177+
string(project_model.WorkflowActionTypeColumn): strconv.FormatInt(column.ID, 10),
177178
},
178179
}
179180

@@ -237,7 +238,7 @@ func TestProjectWorkflowUpdate(t *testing.T) {
237238
WorkflowActions: []project_model.WorkflowAction{
238239
{
239240
Type: project_model.WorkflowActionTypeColumn,
240-
Value: fmt.Sprintf("%d", column.ID),
241+
Value: strconv.FormatInt(column.ID, 10),
241242
},
242243
},
243244
Enabled: true,
@@ -249,12 +250,12 @@ func TestProjectWorkflowUpdate(t *testing.T) {
249250

250251
// Update the workflow
251252
updateData := map[string]any{
252-
"event_id": fmt.Sprintf("%d", workflow.ID),
253+
"event_id": strconv.FormatInt(workflow.ID, 10),
253254
"filters": map[string]any{
254255
string(project_model.WorkflowFilterTypeIssueType): "pull_request", // Change to PR
255256
},
256257
"actions": map[string]any{
257-
string(project_model.WorkflowActionTypeColumn): fmt.Sprintf("%d", column.ID),
258+
string(project_model.WorkflowActionTypeColumn): strconv.FormatInt(column.ID, 10),
258259
},
259260
}
260261

@@ -401,7 +402,7 @@ func TestProjectWorkflowDelete(t *testing.T) {
401402
// Verify we cannot delete it again (should fail gracefully)
402403
req = NewRequest(t, "POST",
403404
fmt.Sprintf("/%s/%s/projects/%d/workflows/%d/delete?_csrf=%s", user.Name, repo.Name, project.ID, workflow.ID, GetUserCSRFToken(t, session)))
404-
resp = session.MakeRequest(t, req, http.StatusNotFound)
405+
session.MakeRequest(t, req, http.StatusNotFound)
405406
}
406407

407408
func TestProjectWorkflowPermissions(t *testing.T) {

0 commit comments

Comments
 (0)