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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing(state/core_accessor): add async submitPFB test case #3387

Closed

Conversation

vgonkivs
Copy link
Member

Additional test case checks whether tx was included in the block after async submission

@vgonkivs vgonkivs added area:state Related to fetching state and state execution kind:testing Related to unit tests labels May 10, 2024
@vgonkivs vgonkivs self-assigned this May 10, 2024
Copy link
Member

@walldiss walldiss left a comment

Choose a reason for hiding this comment

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

Lets improve the test, so in case when it breaks it is easier to identify the root cause.

Comment on lines +97 to +115
hashCh := make(chan string)
for _, tc := range testcases {
if tc.asyncSubmission {
t.Run(tc.name, func(t *testing.T) {
go func() {
resp, err := ca.SubmitPayForBlob(ctx, tc.fee, tc.gasLim, tc.blobs)
if err == nil {
hashCh <- resp.TxHash
}
}()

ctx, cancel := context.WithTimeout(ctx, time.Second*3)
resp, err := ca.signer.ConfirmTx(ctx, <-hashCh)
cancel()
require.NoError(t, err)
require.EqualValues(t, 0, resp.Code)
})
}
}
Copy link
Member

Choose a reason for hiding this comment

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

If ca.SubmitPayForBlob returns non nill error, the test will hang forever because of deadlock on reading from <-hashCh and also no meaningful error will be logged or returned. To fix this lets do:

  • use select with ctx.Done for reading from <-hashCh so test can fail fast
  • use reqiure.NoError for error produced by ca.SubmitPayForBlob to know what happen if it failed.

@vgonkivs
Copy link
Member Author

Moving to draft until the app provides an async version of SubmitPFB method.

@vgonkivs vgonkivs marked this pull request as draft May 13, 2024 09:24
@vgonkivs
Copy link
Member Author

vgonkivs commented Jul 3, 2024

N/A

@vgonkivs vgonkivs closed this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:state Related to fetching state and state execution kind:testing Related to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants