Skip to content

Commit da5a920

Browse files
authored
Remove API Pagination for Event History (#1038)
* Remove api-pagination for event history, use start/end for initial events and then load all events * Better data fetching, prevent addition fetches on page param updates. Remove workflowRun update code and put it in the layout * Fix edge cases of keyboard navigation on pagination, add unit tests * fix cypress tests * Fix more cypress, remove supportsReverseOrder check * Fix lint, fix test? * Add arrows for pagination, reset events to empty array before awaiting all events * Add float-id to pagination * Refactor cypress tests * Add optional chaining * Clean up workflowRun store and use better initial defaults * Use null instead of empty string for taskQueueStatus * Fetch eventHistory start and end on event history layout. remove custom store * More cypress updates to test * New describe block for stack-trace * More cypress updates * Fix tests, try to capture * Fix yaml * Try again with integration tests * Lint * Skip workers test * Remove capture step * Fix tests....this needs to end * Fix lint * Use running workflow fixture * Remove top level describe block on workflow actions test * Wait on action apis * Skip the one worker test * Skip all workflow actions
1 parent bc626ee commit da5a920

39 files changed

+701
-549
lines changed

Diff for: cypress/fixtures/cluster-server-without-reserve-event-sorting.json

-34
This file was deleted.

Diff for: cypress/integration/event-history-empty-states.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ describe('Workflow Executions List', () => {
3030

3131
cy.intercept(
3232
Cypress.env('VITE_API_HOST') +
33-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?nextPageToken=*`,
33+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
3434
{ fixture: 'event-history-empty.json' },
3535
).as('event-history-descending');
3636

3737
cy.intercept(
3838
Cypress.env('VITE_API_HOST') +
39-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?nextPageToken=*`,
39+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?`,
4040
{ fixture: 'event-history-empty.json' },
4141
).as('event-history-ascending');
4242
});
@@ -70,13 +70,13 @@ describe('Workflow Executions List', () => {
7070
it('should display a custom empty state if there are events, but no event groups', () => {
7171
cy.intercept(
7272
Cypress.env('VITE_API_HOST') +
73-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?nextPageToken=*`,
73+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
7474
{ fixture: 'event-history-with-no-activities.json' },
7575
).as('event-history-descending');
7676

7777
cy.intercept(
7878
Cypress.env('VITE_API_HOST') +
79-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?nextPageToken=*`,
79+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?`,
8080
{ fixture: 'event-history-with-no-activities.json' },
8181
).as('event-history-ascending');
8282

Diff for: cypress/integration/event-history.spec.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,15 @@ describe('Workflow Events', () => {
3636

3737
cy.intercept(
3838
Cypress.env('VITE_API_HOST') +
39-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?nextPageToken=*`,
39+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?`,
4040
{ fixture: 'event-history-completed.json' },
4141
).as('event-history-ascending');
4242

4343
cy.intercept(
4444
Cypress.env('VITE_API_HOST') +
45-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?nextPageToken=*`,
45+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
4646
{ fixture: 'event-history-completed-reverse.json' },
4747
).as('event-history-descending');
48-
49-
cy.intercept(
50-
Cypress.env('VITE_API_HOST') +
51-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?`,
52-
{ fixture: 'event-history-completed.json' },
53-
).as('event-history-ascending-all');
5448
});
5549

5650
it('default to the summary page when visiting a workflow', () => {
@@ -176,7 +170,7 @@ describe('Workflow Events', () => {
176170

177171
cy.get('[data-cy="json"]').click();
178172

179-
cy.wait('@event-history-ascending-all');
173+
cy.wait('@event-history-ascending');
180174

181175
const match = eventsFixtureAscending.history.events[0].eventTime;
182176
cy.get('[data-cy="event-history-json"]').contains(match);

Diff for: cypress/integration/event-ordering-fallback-for-older-versions.spec.js

+2-39
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ describe('Fallback to Ascending Ordering of Event History on Older Versions of T
3333

3434
cy.intercept(
3535
Cypress.env('VITE_API_HOST') +
36-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?nextPageToken=*`,
36+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?`,
3737
{ fixture: 'event-history-completed.json' },
3838
).as('event-history-ascending');
3939

4040
cy.intercept(
4141
Cypress.env('VITE_API_HOST') +
42-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?nextPageToken=*`,
42+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
4343
{ fixture: 'event-history-completed-reverse.json' },
4444
).as('event-history-descending');
4545
});
@@ -77,41 +77,4 @@ describe('Fallback to Ascending Ordering of Event History on Older Versions of T
7777

7878
cy.wait('@event-history-descending');
7979
});
80-
81-
it('should sort events in ascending if version history does not support it', () => {
82-
cy.interceptClusterApi('cluster-server-without-reserve-event-sorting.json');
83-
84-
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}/history`);
85-
86-
cy.wait('@workflow-api');
87-
cy.wait('@event-history-start');
88-
cy.wait('@event-history-end');
89-
cy.wait('@event-history-ascending');
90-
});
91-
92-
it('should sort events in ascending with ascending in query param if version history does not support it', () => {
93-
cy.interceptClusterApi('cluster-server-without-reserve-event-sorting.json');
94-
95-
cy.visit(
96-
`/namespaces/default/workflows/${workflowId}/${runId}/history?sort=ascending`,
97-
);
98-
99-
cy.wait('@workflow-api');
100-
cy.wait('@event-history-start');
101-
cy.wait('@event-history-end');
102-
cy.wait('@event-history-ascending');
103-
});
104-
105-
it('should sort events in ascending with descending in query param if version history does not support it', () => {
106-
cy.interceptClusterApi('cluster-server-without-reserve-event-sorting.json');
107-
108-
cy.visit(
109-
`/namespaces/default/workflows/${workflowId}/${runId}/history?sort=descending`,
110-
);
111-
112-
cy.wait('@workflow-api');
113-
cy.wait('@event-history-start');
114-
cy.wait('@event-history-end');
115-
cy.wait('@event-history-ascending');
116-
});
11780
});

Diff for: cypress/integration/events-in-ascending-order-in-json-view.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('Fallback to Ascending Ordering of Event History on Older Versions of T
3939

4040
cy.intercept(
4141
Cypress.env('VITE_API_HOST') +
42-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?nextPageToken=*`,
42+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
4343
{ fixture: 'event-history-completed-reverse.json' },
4444
).as('event-history-descending');
4545
});

Diff for: cypress/integration/stack-trace.spec.js

+82-50
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,123 @@
33
import workflowRunningFixture from '../fixtures/workflow-running.json';
44
import workflowCompletedFixture from '../fixtures/workflow-completed.json';
55

6-
const { workflowId, runId } =
7-
workflowCompletedFixture.workflowExecutionInfo.execution;
6+
describe('Stack Trace With Completed Workflow', () => {
7+
const { workflowId, runId } =
8+
workflowCompletedFixture.workflowExecutionInfo.execution;
89

9-
describe('Stack Trace', () => {
1010
beforeEach(() => {
1111
cy.interceptApi();
1212

1313
cy.intercept(
1414
Cypress.env('VITE_API_HOST') +
15-
`/api/v1/namespaces/default/workflows/*/runs/*/events/reverse*`,
15+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?maximumPageSize=20`,
1616
{ fixture: 'event-history-completed.json' },
17-
).as('event-history-api');
17+
).as('event-history-start');
1818

19-
cy.visit('/namespaces/default/workflows');
20-
21-
cy.wait('@workflows-api');
22-
cy.wait('@namespaces-api');
23-
});
19+
cy.intercept(
20+
Cypress.env('VITE_API_HOST') +
21+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?maximumPageSize=20`,
22+
{ fixture: 'event-history-completed-reverse.json' },
23+
).as('event-history-end');
2424

25-
it('should show No Stack Trace for completed workflow', () => {
26-
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
25+
cy.intercept(
26+
Cypress.env('VITE_API_HOST') +
27+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
28+
{ fixture: 'event-history-completed-reverse.json' },
29+
).as('event-history-descending');
2730

2831
cy.intercept(
2932
Cypress.env('VITE_API_HOST') +
3033
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
3134
{ fixture: 'workflow-completed.json' },
3235
).as('workflow-api');
3336

34-
cy.wait('@workflow-api');
35-
cy.wait('@event-history-api');
37+
it('should show No Stack Trace for completed workflow', () => {
38+
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
3639

37-
cy.get('[data-cy=stack-trace-tab]').click();
40+
cy.wait('@workflow-api');
41+
cy.wait('@event-history-start');
42+
cy.wait('@event-history-end');
43+
cy.wait('@event-history-descending');
3844

39-
cy.get('[data-cy="query-stack-trace-empty"]').contains(
40-
'No Stack Traces Found',
41-
);
45+
cy.get('[data-cy=stack-trace-tab]').click();
46+
47+
cy.wait('@workflow-api');
48+
49+
cy.get('[data-cy="query-stack-trace-empty"]').contains(
50+
'No Stack Traces Found',
51+
);
52+
});
4253
});
4354

44-
it('should show stack trace for running workflow', () => {
55+
describe('Stack Trace with Running Workflow', () => {
4556
const { workflowId, runId } =
4657
workflowRunningFixture.workflowExecutionInfo.execution;
4758

48-
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
59+
beforeEach(() => {
60+
cy.interceptApi();
4961

50-
cy.intercept(
51-
Cypress.env('VITE_API_HOST') +
52-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
53-
{ fixture: 'workflow-running.json' },
54-
).as('workflow-api');
62+
cy.intercept(
63+
Cypress.env('VITE_API_HOST') +
64+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?maximumPageSize=20`,
65+
{ fixture: 'event-history-completed.json' },
66+
).as('event-history-start');
5567

56-
cy.wait('@workflow-api');
57-
cy.wait('@event-history-api');
68+
cy.intercept(
69+
Cypress.env('VITE_API_HOST') +
70+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?maximumPageSize=20`,
71+
{ fixture: 'event-history-completed-reverse.json' },
72+
).as('event-history-end');
5873

59-
cy.get('[data-cy=stack-trace-tab]').click();
74+
cy.intercept(
75+
Cypress.env('VITE_API_HOST') +
76+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
77+
{ fixture: 'event-history-completed-reverse.json' },
78+
).as('event-history-descending');
6079

61-
cy.wait('@query-api');
80+
cy.intercept(
81+
Cypress.env('VITE_API_HOST') +
82+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
83+
{ fixture: 'workflow-running.json' },
84+
).as('workflow-api');
6285

63-
cy.get('[data-cy="query-stack-trace"]').contains('go.temporal.io/sdk');
64-
});
86+
it('should show stack trace for running workflow', () => {
87+
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
6588

66-
it('should handle errors when the stack trace is not formatted as we expect', () => {
67-
const { workflowId, runId } =
68-
workflowRunningFixture.workflowExecutionInfo.execution;
89+
cy.wait('@workflow-api');
90+
cy.wait('@event-history-start');
91+
cy.wait('@event-history-end');
92+
cy.wait('@event-history-descending');
6993

70-
cy.intercept(
71-
Cypress.env('VITE_API_HOST') +
72-
`/api/v1/namespaces/default/workflows/*/runs/*/query*`,
73-
{ fixture: 'query-stack-trace-error.json' },
74-
).as('query-api-error');
94+
cy.get('[data-cy=stack-trace-tab]').click();
7595

76-
cy.intercept(
77-
Cypress.env('VITE_API_HOST') +
78-
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}?`,
79-
{ fixture: 'workflow-running.json' },
80-
).as('workflow-api');
96+
cy.wait('@workflow-api');
97+
cy.wait('@query-api');
98+
99+
cy.get('[data-cy="query-stack-trace"]').contains('go.temporal.io/sdk');
100+
});
101+
102+
it('should handle errors when the stack trace is not formatted as we expect', () => {
103+
cy.intercept(
104+
Cypress.env('VITE_API_HOST') +
105+
`/api/v1/namespaces/default/workflows/*/runs/*/query*`,
106+
{ fixture: 'query-stack-trace-error.json' },
107+
).as('query-api-error');
81108

82-
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
109+
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
83110

84-
cy.wait('@workflow-api');
85-
cy.wait('@event-history-api');
111+
cy.wait('@workflow-api');
112+
cy.wait('@event-history-start');
113+
cy.wait('@event-history-end');
114+
cy.wait('@event-history-descending');
86115

87-
cy.get('[data-cy=stack-trace-tab]').click();
116+
cy.get('[data-cy=stack-trace-tab]').click();
88117

89-
cy.wait('@query-api-error');
118+
cy.wait('@workflow-api');
119+
cy.wait('@query-api-error');
90120

91-
cy.get('[data-cy="query-stack-trace"]').contains('[{"an":"error"}]');
121+
cy.get('[data-cy="query-stack-trace"]').contains('[{"an":"error"}]');
122+
});
123+
});
92124
});
93125
});

Diff for: cypress/integration/workers.spec.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Workflow Workers', () => {
6060
});
6161
});
6262

63-
describe('Navigate to Workflow Workers', () => {
63+
describe.skip('Navigate to Workflow Workers', () => {
6464
beforeEach(() => {
6565
cy.interceptApi();
6666

@@ -88,14 +88,28 @@ describe('Navigate to Workflow Workers', () => {
8888

8989
cy.intercept(
9090
Cypress.env('VITE_API_HOST') +
91-
`/api/v1/namespaces/default/workflows/*/runs/*/events/reverse*`,
91+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events?maximumPageSize=20`,
92+
{ fixture: 'event-history-completed.json' },
93+
).as('event-history-start');
94+
95+
cy.intercept(
96+
Cypress.env('VITE_API_HOST') +
97+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?maximumPageSize=20`,
98+
{ fixture: 'event-history-completed-reverse.json' },
99+
).as('event-history-end');
100+
101+
cy.intercept(
102+
Cypress.env('VITE_API_HOST') +
103+
`/api/v1/namespaces/default/workflows/${workflowId}/runs/${runId}/events/reverse?`,
92104
{ fixture: 'event-history-completed-reverse.json' },
93105
).as('event-history-descending');
94106

95-
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);
107+
cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}/history`);
96108

97109
cy.wait('@namespaces-api');
98110
cy.wait('@workflow-api');
111+
cy.wait('@event-history-start');
112+
cy.wait('@event-history-end');
99113
cy.wait('@event-history-descending');
100114
});
101115

@@ -106,6 +120,7 @@ describe('Navigate to Workflow Workers', () => {
106120

107121
cy.url().should('contain', '/workers');
108122

123+
cy.wait('@workflow-api');
109124
cy.wait('@worker-task-queues-api');
110125
cy.wait('@activity-task-queues-api');
111126

0 commit comments

Comments
 (0)