Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improvements to the test run events #2405

Merged

Conversation

xoscar
Copy link
Collaborator

@xoscar xoscar commented Apr 18, 2023

This PR adds several improvements to the events triggered by the BE when executing a test run

Changes

  • Updates event sequence to match the initial vision I never documented 馃ゴ
  • Adds better information for the FE when it comes to polling iteration info

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

I Encourage you to take a look at the loom video

https://www.loom.com/share/9353520fe43c49c6897f26b45975c2c3

@xoscar xoscar self-assigned this Apr 18, 2023
@xoscar xoscar linked an issue Apr 18, 2023 that may be closed by this pull request
@xoscar xoscar marked this pull request as ready for review April 18, 2023 20:53
@@ -208,7 +208,7 @@ func (e *defaultAssertionRunner) emitFailedAssertions(ctx context.Context, req A
}

if errors.Is(spanAssertionResult.CompareErr, expression.ErrInvalidSyntax) {
e.eventEmitter.Emit(ctx, events.TestSpecsAssertionError(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this from errors to warnings as these don't stop the test run


err = pe.eventEmitter.Emit(request.ctx, events.TraceFetchingStart(request.test.ID, request.run.ID))
if err != nil {
log.Printf("[PollerExecutor] Test %s Run %d: failed to emit TraceFetchingStart event: error: %s\n", request.test.ID, request.run.ID, err.Error())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving some events ideally this file should only trigger "polling" specific events

@@ -141,12 +141,14 @@ func (tp tracePoller) processJob(job PollingRequest) {
}

if job.IsFirstRequest() {
err := tp.eventEmitter.Emit(job.ctx, events.TracePollingStart(job.test.ID, job.run.ID))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As main orchestrator, here we should trigger fetching trace events

<S.Column>
<S.InfoIcon />
<div>
<Typography.Title level={3}>Polling profile configuration:</Typography.Title>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding polling profile info

Copy link
Contributor

@danielbdias danielbdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I've added two suggestions, do they make sense?

log.Printf("[PollerExecutor] Test %s Run %d: failed to emit TraceFetchingStart event: error: %s\n", request.test.ID, request.run.ID, err.Error())
err = pe.eventEmitter.Emit(request.ctx, events.TracePollingStart(request.test.ID, request.run.ID))
if err != nil {
log.Printf("[PollerExecutor] Test %s Run %d: failed to emit TraceFetchingStart event: error: %s\n", request.test.ID, request.run.ID, err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Printf("[PollerExecutor] Test %s Run %d: failed to emit TraceFetchingStart event: error: %s\n", request.test.ID, request.run.ID, err.Error())
log.Printf("[PollerExecutor] Test %s Run %d: failed to emit TracePollingStart event: error: %s\n", request.test.ID, request.run.ID, err.Error())

@@ -123,7 +123,7 @@ func (tp tracePoller) Stop() {
func (tp tracePoller) Poll(ctx context.Context, test model.Test, run model.Run) {
log.Printf("[TracePoller] Test %s Run %d: Poll\n", test.ID, run.ID)

job := NewPollingRequest(ctx, test, run, 0)
job := NewPollingRequest(ctx, test, run, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this number as a constant on this file? Something like PollingRequestStartIteration ?

Suggested change
job := NewPollingRequest(ctx, test, run, 1)
job := NewPollingRequest(ctx, test, run, PollingRequestStartIteration)

@xoscar xoscar merged commit daf930c into main Apr 19, 2023
28 checks passed
@xoscar xoscar deleted the 2400-error-handling-fix-event-logs-for-the-polling-mechanism branch April 19, 2023 15:15
schoren pushed a commit that referenced this pull request Jun 5, 2023
* fix: improvements to the test run events

* PR comment updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Error Handling] Fix Event Logs for the polling mechanism
3 participants