Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-21 17:34:24 +01:00

chore: Fix a few lint errors

- Adjust `PrepareArtifactsStorage` to use `require.NoError` instead of
  `assert.NoError`
- Adjust `TestActionsArtifactDownload` to have the proper order of
  `assert.Equal` arguments.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-11-03 11:33:32 +01:00
parent 268276d4a7
commit ae6292ba38
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -126,7 +126,7 @@ func TestActionsArtifactDownload(t *testing.T) {
} }
} }
assert.NotNil(t, artifactIdx) assert.NotNil(t, artifactIdx)
assert.Equal(t, listResp.Value[artifactIdx].Name, "artifact-download") assert.Equal(t, "artifact-download", listResp.Value[artifactIdx].Name)
assert.Contains(t, listResp.Value[artifactIdx].FileContainerResourceURL, "/api/actions_pipeline/_apis/pipelines/workflows/791/artifacts") assert.Contains(t, listResp.Value[artifactIdx].FileContainerResourceURL, "/api/actions_pipeline/_apis/pipelines/workflows/791/artifacts")
idx := strings.Index(listResp.Value[artifactIdx].FileContainerResourceURL, "/api/actions_pipeline/_apis/pipelines/") idx := strings.Index(listResp.Value[artifactIdx].FileContainerResourceURL, "/api/actions_pipeline/_apis/pipelines/")

View file

@ -226,13 +226,13 @@ func cancelProcesses(t testing.TB, delay time.Duration) {
func PrepareArtifactsStorage(t testing.TB) { func PrepareArtifactsStorage(t testing.TB) {
// prepare actions artifacts directory and files // prepare actions artifacts directory and files
assert.NoError(t, storage.Clean(storage.ActionsArtifacts)) require.NoError(t, storage.Clean(storage.ActionsArtifacts))
s, err := storage.NewStorage(setting.LocalStorageType, &setting.Storage{ s, err := storage.NewStorage(setting.LocalStorageType, &setting.Storage{
Path: filepath.Join(filepath.Dir(setting.AppPath), "tests", "testdata", "data", "artifacts"), Path: filepath.Join(filepath.Dir(setting.AppPath), "tests", "testdata", "data", "artifacts"),
}) })
assert.NoError(t, err) require.NoError(t, err)
assert.NoError(t, s.IterateObjects("", func(p string, obj storage.Object) error { require.NoError(t, s.IterateObjects("", func(p string, obj storage.Object) error {
_, err = storage.Copy(storage.ActionsArtifacts, p, s, p) _, err = storage.Copy(storage.ActionsArtifacts, p, s, p)
return err return err
})) }))