Skip to content

Commit 24c7b6e

Browse files
committed
update dataset viewer integration test
1 parent 78519d6 commit 24c7b6e

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

tests/api/dataset_viewer_test.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)