-
Notifications
You must be signed in to change notification settings - Fork 9
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
End to end test example #75
Conversation
3e4044d
to
d0094f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, will be a nice addition! I think we can make it slightly easier to be replicated by having two files for the testing logic: one to copy over with the logic of setting everything up (later to be put into an npm package), and one which just shows a single test that then uses the setup. What do you think?
Also, can we add an example for the handler API as well?
Can I do this in a followup? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for splitting up! Much nicer now.
I get the following error when running npm run test
FAIL test/test.ts
● ExampleService › works
Error 404 during registration:
79 | if (!res.ok) {
80 | const badResponse = await res.text();
> 81 | throw new Error(
| ^
82 | `Error ${res.status} during registration: ${badResponse}`
83 | );
84 | }
at prepareRestateTestContainer (test/restate_test_environment.ts:81:13)
at Function.start (test/restate_test_environment.ts:121:35)
at Object.<anonymous> (test/test.ts:15:30)
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'stop')
31 | // Stop Restate and the Service endpoint
32 | afterAll(async () => {
> 33 | await restateTestEnvironment.stop();
| ^
34 | });
35 |
36 | it("works", async () => {
at Object.<anonymous> (test/test.ts:33:34)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.987 s, estimated 6 s
Ran all test suites.
Jest has detected the following 1 open handle potentially keeping Jest from exiting:
● TCPSERVERWRAP
22 | await new Promise((resolve, reject) => {
23 | restateHttpServer
> 24 | .listen(0)
| ^
25 | .once("listening", resolve)
26 | .once("error", reject);
27 | });
at test/restate_test_environment.ts:24:8
at prepareRestateServer (test/restate_test_environment.ts:22:9)
at Function.start (test/restate_test_environment.ts:120:42)
at Object.<anonymous> (test/test.ts:15:59)
Perhaps you have an old image? |
222a047
to
161f03b
Compare
@slinkydeveloper That was indeed the issue.
I guess if I bump into this, I am not the only one. |
LGTM! |
Fix restatedev/node-template-generator#18 and restatedev/sdk-typescript#101, replaces restatedev/node-template-generator#19