From 3dd4b846903f0f0150653be5a6c5ea38fc42bf8b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 14 Apr 2025 17:42:34 +0300 Subject: [PATCH] chore(tests): Fix flaky birdbox:postgresql tests (due to order by same numbers) --- .../birdbox-postgresql.test.ts.snap | 80 +++++++++---------- .../__snapshots__/cli-postgresql.test.ts.snap | 76 +++++++++--------- .../cubejs-testing/test/abstract-test-case.ts | 5 +- 3 files changed, 81 insertions(+), 80 deletions(-) diff --git a/packages/cubejs-testing/test/__snapshots__/birdbox-postgresql.test.ts.snap b/packages/cubejs-testing/test/__snapshots__/birdbox-postgresql.test.ts.snap index 67af5eb072c89..f6cab51358c68 100644 --- a/packages/cubejs-testing/test/__snapshots__/birdbox-postgresql.test.ts.snap +++ b/packages/cubejs-testing/test/__snapshots__/birdbox-postgresql.test.ts.snap @@ -16,35 +16,39 @@ Array [ ] `; -exports[`postgresql HTTP Transport #3 Events.count with Events.type order by Events.count DESC: #3 Events.count with Events.type order by Events.count DESC 1`] = ` +exports[`postgresql HTTP Transport #3 Events.count with Events.type order by Events.type DESC, Events.count: #3 Events.count with Events.type order by Events.type DESC, Events.count 1`] = ` Array [ + Object { + "Events.count": "92", + "Events.type": "WatchEvent", + }, + Object { + "Events.count": "2", + "Events.type": "ReleaseEvent", + }, Object { "Events.count": "513", "Events.type": "PushEvent", }, Object { - "Events.count": "120", - "Events.type": "CreateEvent", + "Events.count": "21", + "Events.type": "PullRequestReviewCommentEvent", }, Object { - "Events.count": "104", - "Events.type": "IssueCommentEvent", + "Events.count": "32", + "Events.type": "PullRequestEvent", }, Object { - "Events.count": "92", - "Events.type": "WatchEvent", + "Events.count": "1", + "Events.type": "MemberEvent", }, Object { "Events.count": "57", "Events.type": "IssuesEvent", }, Object { - "Events.count": "32", - "Events.type": "PullRequestEvent", - }, - Object { - "Events.count": "21", - "Events.type": "ForkEvent", + "Events.count": "104", + "Events.type": "IssueCommentEvent", }, Object { "Events.count": "21", @@ -52,19 +56,15 @@ Array [ }, Object { "Events.count": "21", - "Events.type": "PullRequestReviewCommentEvent", + "Events.type": "ForkEvent", }, Object { "Events.count": "14", "Events.type": "DeleteEvent", }, Object { - "Events.count": "2", - "Events.type": "ReleaseEvent", - }, - Object { - "Events.count": "1", - "Events.type": "MemberEvent", + "Events.count": "120", + "Events.type": "CreateEvent", }, Object { "Events.count": "1", @@ -97,35 +97,39 @@ Array [ ] `; -exports[`postgresql WS Transport #3 Events.count with Events.type order by Events.count DESC: #3 Events.count with Events.type order by Events.count DESC 1`] = ` +exports[`postgresql WS Transport #3 Events.count with Events.type order by Events.type DESC, Events.count: #3 Events.count with Events.type order by Events.type DESC, Events.count 1`] = ` Array [ + Object { + "Events.count": "92", + "Events.type": "WatchEvent", + }, + Object { + "Events.count": "2", + "Events.type": "ReleaseEvent", + }, Object { "Events.count": "513", "Events.type": "PushEvent", }, Object { - "Events.count": "120", - "Events.type": "CreateEvent", + "Events.count": "21", + "Events.type": "PullRequestReviewCommentEvent", }, Object { - "Events.count": "104", - "Events.type": "IssueCommentEvent", + "Events.count": "32", + "Events.type": "PullRequestEvent", }, Object { - "Events.count": "92", - "Events.type": "WatchEvent", + "Events.count": "1", + "Events.type": "MemberEvent", }, Object { "Events.count": "57", "Events.type": "IssuesEvent", }, Object { - "Events.count": "32", - "Events.type": "PullRequestEvent", - }, - Object { - "Events.count": "21", - "Events.type": "ForkEvent", + "Events.count": "104", + "Events.type": "IssueCommentEvent", }, Object { "Events.count": "21", @@ -133,19 +137,15 @@ Array [ }, Object { "Events.count": "21", - "Events.type": "PullRequestReviewCommentEvent", + "Events.type": "ForkEvent", }, Object { "Events.count": "14", "Events.type": "DeleteEvent", }, Object { - "Events.count": "2", - "Events.type": "ReleaseEvent", - }, - Object { - "Events.count": "1", - "Events.type": "MemberEvent", + "Events.count": "120", + "Events.type": "CreateEvent", }, Object { "Events.count": "1", diff --git a/packages/cubejs-testing/test/__snapshots__/cli-postgresql.test.ts.snap b/packages/cubejs-testing/test/__snapshots__/cli-postgresql.test.ts.snap index cf99d6660a764..3cb010729d78e 100644 --- a/packages/cubejs-testing/test/__snapshots__/cli-postgresql.test.ts.snap +++ b/packages/cubejs-testing/test/__snapshots__/cli-postgresql.test.ts.snap @@ -16,40 +16,44 @@ Array [ ] `; -exports[`postgresql HTTP Transport #3 Events.count with Events.type order by Events.count DESC: #3 Events.count with Events.type order by Events.count DESC 1`] = ` +exports[`postgresql HTTP Transport #3 Events.count with Events.type order by Events.type DESC, Events.count: #3 Events.count with Events.type order by Events.type DESC, Events.count 1`] = ` Array [ + Object { + "Events.count": "92", + "Events.type": "WatchEvent", + }, + Object { + "Events.count": "2", + "Events.type": "ReleaseEvent", + }, Object { "Events.count": "513", "Events.type": "PushEvent", }, Object { - "Events.count": "120", - "Events.type": "CreateEvent", + "Events.count": "21", + "Events.type": "PullRequestReviewCommentEvent", }, Object { - "Events.count": "104", - "Events.type": "IssueCommentEvent", + "Events.count": "32", + "Events.type": "PullRequestEvent", }, Object { - "Events.count": "92", - "Events.type": "WatchEvent", + "Events.count": "1", + "Events.type": "MemberEvent", }, Object { "Events.count": "57", "Events.type": "IssuesEvent", }, Object { - "Events.count": "32", - "Events.type": "PullRequestEvent", + "Events.count": "104", + "Events.type": "IssueCommentEvent", }, Object { "Events.count": "21", "Events.type": "GollumEvent", }, - Object { - "Events.count": "21", - "Events.type": "PullRequestReviewCommentEvent", - }, Object { "Events.count": "21", "Events.type": "ForkEvent", @@ -59,12 +63,8 @@ Array [ "Events.type": "DeleteEvent", }, Object { - "Events.count": "2", - "Events.type": "ReleaseEvent", - }, - Object { - "Events.count": "1", - "Events.type": "MemberEvent", + "Events.count": "120", + "Events.type": "CreateEvent", }, Object { "Events.count": "1", @@ -186,40 +186,44 @@ Array [ ] `; -exports[`postgresql WS Transport #3 Events.count with Events.type order by Events.count DESC: #3 Events.count with Events.type order by Events.count DESC 1`] = ` +exports[`postgresql WS Transport #3 Events.count with Events.type order by Events.type DESC, Events.count: #3 Events.count with Events.type order by Events.type DESC, Events.count 1`] = ` Array [ + Object { + "Events.count": "92", + "Events.type": "WatchEvent", + }, + Object { + "Events.count": "2", + "Events.type": "ReleaseEvent", + }, Object { "Events.count": "513", "Events.type": "PushEvent", }, Object { - "Events.count": "120", - "Events.type": "CreateEvent", + "Events.count": "21", + "Events.type": "PullRequestReviewCommentEvent", }, Object { - "Events.count": "104", - "Events.type": "IssueCommentEvent", + "Events.count": "32", + "Events.type": "PullRequestEvent", }, Object { - "Events.count": "92", - "Events.type": "WatchEvent", + "Events.count": "1", + "Events.type": "MemberEvent", }, Object { "Events.count": "57", "Events.type": "IssuesEvent", }, Object { - "Events.count": "32", - "Events.type": "PullRequestEvent", + "Events.count": "104", + "Events.type": "IssueCommentEvent", }, Object { "Events.count": "21", "Events.type": "GollumEvent", }, - Object { - "Events.count": "21", - "Events.type": "PullRequestReviewCommentEvent", - }, Object { "Events.count": "21", "Events.type": "ForkEvent", @@ -229,12 +233,8 @@ Array [ "Events.type": "DeleteEvent", }, Object { - "Events.count": "2", - "Events.type": "ReleaseEvent", - }, - Object { - "Events.count": "1", - "Events.type": "MemberEvent", + "Events.count": "120", + "Events.type": "CreateEvent", }, Object { "Events.count": "1", diff --git a/packages/cubejs-testing/test/abstract-test-case.ts b/packages/cubejs-testing/test/abstract-test-case.ts index af511be97cb75..cc2bc4c02a357 100644 --- a/packages/cubejs-testing/test/abstract-test-case.ts +++ b/packages/cubejs-testing/test/abstract-test-case.ts @@ -40,7 +40,7 @@ const asserts: [options: QueryTestOptions, query: Query][] = [ ], [ { - name: '#3 Events.count with Events.type order by Events.count DESC', + name: '#3 Events.count with Events.type order by Events.type DESC, Events.count', ws: true, }, { @@ -49,7 +49,8 @@ const asserts: [options: QueryTestOptions, query: Query][] = [ ], timeDimensions: [], order: { - 'Events.count': 'desc' + 'Events.type': 'desc', + 'Events.count': 'asc' }, dimensions: [ 'Events.type'