From 50a137e1d7f8c249844898e4bf471df8a63bbe32 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Sun, 7 Apr 2024 17:48:22 +0800 Subject: [PATCH] fix TestAPI Signed-off-by: Ryan Leung --- tests/server/api/scheduler_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/server/api/scheduler_test.go b/tests/server/api/scheduler_test.go index 3b98be4bbb5..67fb0cd8700 100644 --- a/tests/server/api/scheduler_test.go +++ b/tests/server/api/scheduler_test.go @@ -252,12 +252,12 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) { body, err := json.Marshal(dataMap) re.NoError(err) re.NoError(tu.CheckPostJSON(testDialClient, updateURL, body, tu.StatusOK(re))) - resp = make(map[string]any) - re.NoError(tu.ReadGetJSON(re, testDialClient, listURL, &resp)) - - for key := range expectMap { - re.Equal(expectMap[key], resp[key], "key %s", key) - } + tu.Eventually(re, func() bool { + resp = make(map[string]any) + re.NoError(tu.ReadGetJSON(re, testDialClient, listURL, &resp)) + return expectMap["max-zombie-rounds"] == resp["max-zombie-rounds"] && + expectMap["min-hot-byte-rate"] == resp["min-hot-byte-rate"] + }) // update again err = tu.CheckPostJSON(testDialClient, updateURL, body,