diff --git a/modules/git/repo_tag_test.go b/modules/git/repo_tag_test.go index d88851551f..d825dbd973 100644 --- a/modules/git/repo_tag_test.go +++ b/modules/git/repo_tag_test.go @@ -4,6 +4,7 @@ package git import ( + "fmt" "path/filepath" "testing" "time" @@ -150,7 +151,8 @@ func TestRepository_GetAnnotatedTag(t *testing.T) { // Annotated tag's name should fail tag3, err := bareRepo1.GetAnnotatedTag(aTagName) require.Error(t, err) - require.Errorf(t, err, "Length must be 40: %d", len(aTagName)) + require.ErrorContains(t, err, + fmt.Sprintf("length %d has no matched object format: %s", len(aTagName), aTagName)) assert.Nil(t, tag3) // Lightweight Tag should fail diff --git a/modules/setting/actions_test.go b/modules/setting/actions_test.go index 8320b2057b..7d32131d32 100644 --- a/modules/setting/actions_test.go +++ b/modules/setting/actions_test.go @@ -4,6 +4,7 @@ package setting import ( + "fmt" "path/filepath" "testing" @@ -214,5 +215,6 @@ func Test_getIDTokenSettingsForActions(t *testing.T) { cfg, err = NewConfigProviderFromData(iniStr) require.NoError(t, err) err = loadActionsFrom(cfg) - require.Errorf(t, err, "invalid [actions] ID_TOKEN_SIGNING_ALGORITHM %q", Actions.IDTokenSigningAlgorithm) + require.ErrorContains(t, err, + fmt.Sprintf("invalid [actions] ID_TOKEN_SIGNING_ALGORITHM: %q", Actions.IDTokenSigningAlgorithm)) }