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

feat: test hook error handling #202

Merged
merged 11 commits into from
Apr 3, 2024
Merged

feat: test hook error handling #202

merged 11 commits into from
Apr 3, 2024

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Mar 28, 2024

This introduces a test that the SDK can successfully recover from a hook stage returning an error or throwing an exception. It runs under existing capability evaluation-hooks.

This introduces a new errors object on the Hooks service definition which SDKs must inspect. It contains an error message that should be thrown/returned from a specific stage.

I've only written one test here, which is that:

  • For N hooks, given an error in the beforeEvaluation stage, ensure the afterEvaluation stage still runs.

Existing SDKs are expected to fail this test until implemented. I thought about having it as a new capability, but it is part of the base spec and the reminder (seeing the test fail) should be helpful.

@cwaldren-ld cwaldren-ld marked this pull request as ready for review April 2, 2024 20:13
@cwaldren-ld cwaldren-ld requested a review from a team April 2, 2024 20:13
@@ -78,3 +84,28 @@ func (h *Hooks) ExpectCall(t *ldtest.T, hookName string,
}
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a somewhat janky expectation method. But, we couldn't quite think of what we'd want to see if this was more generic.

So, I think we should feel free to refactor or replace this when the time comes. Or now, if there's a better idea.

@tanderson-ld
Copy link
Contributor

I approve, but since we paired on this and others have started reviewing, I will not officially approve to give other reviewers an opportunity before it merges.

docs/service_spec.md Outdated Show resolved Hide resolved
@cwaldren-ld cwaldren-ld merged commit 256ae92 into v2 Apr 3, 2024
2 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/hook-errors branch April 3, 2024 19:10
kinyoklion pushed a commit that referenced this pull request Apr 8, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.10.0](v2.9.0...v2.10.0)
(2024-04-03)


### Features

* test hook error handling
([#202](#202))
([256ae92](256ae92))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants