@@ -2,6 +2,7 @@ package callback
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67 "testing"
78 "time"
@@ -211,6 +212,30 @@ func TestGitCallbackComponentImpl_UpdateRepoInfos(t *testing.T) {
211212 err := gc .UpdateRepoInfos (context .Background (), req )
212213 assert .NoError (t , err )
213214 })
215+
216+ t .Run ("should skip model metadata update failure" , func (t * testing.T ) {
217+ gc := initializeTestGitCallbackComponent (context .Background (), t )
218+ req := & types.GiteaCallbackPushReq {
219+ Ref : "refs/heads/main" ,
220+ Repository : types.GiteaCallbackPushReq_Repository {
221+ FullName : "models_namespace/repo" ,
222+ },
223+ Commits : []types.GiteaCallbackPushReq_Commit {
224+ {
225+ Modified : []string {"config.json" },
226+ Removed : []string {"old_file.txt" },
227+ },
228+ },
229+ }
230+
231+ gc .mocks .stores .RepoMock ().EXPECT ().FindByPath (ctx , types .ModelRepo , "namespace" , "repo" ).Return (repo , nil )
232+ gc .mocks .runtimeArchComponent .EXPECT ().UpdateModelMetadata (ctx , repo ).Return (nil , errors .New ("unsupported model format unknown" ))
233+ gc .mocks .stores .RepoMock ().EXPECT ().FindByPath (ctx , types .ModelRepo , "namespace" , "repo" ).Return (repo , nil )
234+ gc .mocks .tagComponent .EXPECT ().UpdateLibraryTags (ctx , types .ModelTagScope , "namespace" , "repo" , "old_file.txt" , "" ).Return (nil )
235+
236+ err := gc .UpdateRepoInfos (context .Background (), req )
237+ assert .NoError (t , err )
238+ })
214239}
215240
216241func TestGitCallbackComponentImpl_CalculateRepoSize (t * testing.T ) {
0 commit comments