Skip to content

Commit

Permalink
Flaky test fields iteration order (#4095)
Browse files Browse the repository at this point in the history
* Fix flaky test testAssembleLongPollRefreshUrlWithMultipleNamespaces.

* Fix flaky test testAssembleLongPollRefreshUrl.

* Update assertions in testAssembleLongPollRefreshUrl and testAssembleLongPollRefreshUrlWithMultipleNamespaces.

Co-authored-by: Jason Song <[email protected]>
  • Loading branch information
yyfMichaelYan and nobodyiam authored Nov 26, 2021
1 parent 9e19898 commit 80a33ab
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,10 @@ public void testAssembleLongPollRefreshUrl() throws Exception {
assertTrue(longPollRefreshUrl.contains(someServerUrl + "/notifications/v2?"));
assertTrue(longPollRefreshUrl.contains("appId=" + someAppId));
assertTrue(longPollRefreshUrl.contains("cluster=someCluster%2B+%26.-_someSign"));
assertTrue(longPollRefreshUrl.contains(
"notifications=%5B%7B%22namespaceName%22%3A%22" + someNamespace
+ "%22%2C%22notificationId%22%3A" + 1 + "%7D%5D"));
assertTrue(longPollRefreshUrl.contains("notifications=%5B%7B")
&& longPollRefreshUrl.contains("%22namespaceName%22%3A%22" + someNamespace + "%22")
&& longPollRefreshUrl.contains("%22notificationId%22%3A" + someNotificationId)
&& longPollRefreshUrl.contains("%7D%5D"));
}

@Test
Expand All @@ -532,11 +533,12 @@ public void testAssembleLongPollRefreshUrlWithMultipleNamespaces() throws Except
assertTrue(longPollRefreshUrl.contains(someServerUrl + "/notifications/v2?"));
assertTrue(longPollRefreshUrl.contains("appId=" + someAppId));
assertTrue(longPollRefreshUrl.contains("cluster=someCluster%2B+%26.-_someSign"));
assertTrue(
longPollRefreshUrl.contains("notifications=%5B%7B%22namespaceName%22%3A%22" + someNamespace
+ "%22%2C%22notificationId%22%3A" + someNotificationId
+ "%7D%2C%7B%22namespaceName%22%3A%22" + anotherNamespace
+ "%22%2C%22notificationId%22%3A" + anotherNotificationId + "%7D%5D"));
assertTrue(longPollRefreshUrl.contains("notifications=%5B%7B")
&& longPollRefreshUrl.contains("%22namespaceName%22%3A%22" + someNamespace + "%22")
&& longPollRefreshUrl.contains("%22notificationId%22%3A" + someNotificationId)
&& longPollRefreshUrl.contains("%22namespaceName%22%3A%22" + anotherNamespace + "%22")
&& longPollRefreshUrl.contains("%22notificationId%22%3A" + anotherNotificationId)
&& longPollRefreshUrl.contains("%7D%5D"));
}

public static class MockConfigUtil extends ConfigUtil {
Expand Down

0 comments on commit 80a33ab

Please sign in to comment.