@@ -107,12 +107,21 @@ configs:
107107 require .Equal (t , expected , string (body ))
108108
109109 // check auto created branch
110- time .Sleep (2 * time .Second )
111- resp , err = userClient .Get ("http://localhost:9091/api/v1/datasets/user/test/branches" )
112- require .NoError (t , err )
113- defer resp .Body .Close ()
114- body , err = io .ReadAll (resp .Body )
115- require .NoError (t , err )
116- branches := gjson .GetBytes (body , "data.#.name" ).String ()
117- require .Equal (t , `["main","refs-convert-parquet"]` , branches )
110+ maxAttempts := 10
111+ for attempts := 1 ; attempts <= maxAttempts ; attempts ++ {
112+ resp , err = userClient .Get ("http://localhost:9091/api/v1/datasets/user/test/branches" )
113+ require .NoError (t , err )
114+ defer resp .Body .Close ()
115+ body , err = io .ReadAll (resp .Body )
116+ require .NoError (t , err )
117+ branches := gjson .GetBytes (body , "data.#.name" ).String ()
118+ if branches == `["main","refs-convert-parquet"]` {
119+ break
120+ }
121+ if attempts < maxAttempts {
122+ time .Sleep (1 * time .Second )
123+ } else {
124+ require .FailNow (t , "Branch check failed" )
125+ }
126+ }
118127}
0 commit comments