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

Fix bug with error state writing #6

Merged
merged 1 commit into from
Jul 31, 2024
Merged

Fix bug with error state writing #6

merged 1 commit into from
Jul 31, 2024

Conversation

thesilentg
Copy link
Contributor

Errors were not being added to the state file

@@ -716,10 +717,14 @@ func TestProcessor_Serialization(t *testing.T) {
State[MyAppContext, MyOverallContext, MyJobContext]{
TriggerState: TRIGGER_STATE_NEW,
Exec: func(ctx context.Context, ac MyAppContext, oc MyOverallContext, jc MyJobContext) (MyJobContext, string, []KickRequest[MyJobContext], error) {
if jc.Count == 1 {
return jc, STATE_DONE, nil, errors.New("errored again")
Copy link
Owner

Choose a reason for hiding this comment

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

Why errors again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to confirm that if multiple errors are detected, they are recorded separately and don't clobber each other. You can see this assertion lower in the test case

// Execute the job
rtn := Return[JC]{
PriorState: j.State,
PriorState: priorState,
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a test that catches this bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The updated test case does

@@ -716,10 +717,14 @@ func TestProcessor_Serialization(t *testing.T) {
State[MyAppContext, MyOverallContext, MyJobContext]{
TriggerState: TRIGGER_STATE_NEW,
Exec: func(ctx context.Context, ac MyAppContext, oc MyOverallContext, jc MyJobContext) (MyJobContext, string, []KickRequest[MyJobContext], error) {
if jc.Count == 1 {
return jc, STATE_DONE, nil, errors.New("errored again")
Copy link
Owner

Choose a reason for hiding this comment

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

Test for this?

Copy link
Owner

Choose a reason for hiding this comment

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

I see it

@gaffo gaffo merged commit 2f2ad66 into gaffo:main Jul 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants