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

End to end test example #75

Merged
merged 8 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix typescript run verify --workspaces

- name: "Test typescript-end-to-end-testing example"
working-directory: ./typescript/end-to-end-testing
run: npm ci && npm run proto && npm run test

# Setup Java
- uses: actions/setup-java@v3
if: github.event.inputs.sdkJavaVersion != ''
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
typescript-hello-world-lambda.zip
typescript-hello-world-lambda-cdk.zip
typescript-dynamic-workflow-executor.zip
typescript-end-to-end-testing.zip
java-hello-world-http.zip
java-hello-world-lambda.zip
java-food-ordering.zip
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ jobs:

- run: npm ci --prefix typescript
- run: npm run --prefix typescript -ws verify

- name: "Test typescript-end-to-end-testing example"
working-directory: ./typescript/end-to-end-testing
run: npm ci && npm run proto && npm run test
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ wget https://github.com/restatedev/examples/releases/latest/download/kotlin-hell
wget https://github.com/restatedev/examples/releases/latest/download/typescript-payment-api.zip && unzip typescript-payment-api.zip -d typescript-payment-api && rm typescript-payment-api.zip
```

[End-to-end testing](typescript/end-to-end-testing): Example of how to test Restate services end-to-end
```shell
wget https://github.com/restatedev/examples/releases/latest/download/typescript-end-to-end-testing.zip && unzip typescript-end-to-end-testing.zip -d typescript-end-to-end-testing && rm typescript-end-to-end-testing.zip
```

## Applications

![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)
Expand Down
1 change: 1 addition & 0 deletions scripts/prepare_release_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ create_release_zip kotlin hello-world-lambda-cdk

create_release_zip typescript hello-world-lambda
create_release_zip typescript hello-world-lambda-cdk
create_release_zip typescript end-to-end-testing
create_release_zip typescript ecommerce-store
create_release_zip typescript food-ordering
create_release_zip typescript payment-api
Expand Down
5 changes: 5 additions & 0 deletions typescript/end-to-end-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules
**/dist
**/.vscode
**/.idea
**/generated
27 changes: 27 additions & 0 deletions typescript/end-to-end-testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Typescript End to End service test example

Restate is a system for easily building resilient applications using **distributed durable RPC & async/await**.

This example shows how to test Restate services by deploying Restate with [TestContainers](https://node.testcontainers.org/). It is loosely based on the [Typescript gRPC template](https://github.com/restatedev/node-template-generator#grpc-variant).

## Download the example

```shell
wget https://github.com/restatedev/examples/releases/latest/download/typescript-end-to-end-testing.zip && unzip typescript-end-to-end-testing.zip -d typescript-end-to-end-testing && rm typescript-end-to-end-testing.zip
```

## Run

Install the dependencies and run the `buf` code generation first:

```shell
npm install & npm run proto
```

Now you can run the tests:

```shell
npm run test
```

If you are encountering errors, try to pull the latest docker image: `docker pull docker.io/restatedev/restate:latest`.
9 changes: 9 additions & 0 deletions typescript/end-to-end-testing/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
roots: ["<rootDir>/test"],
testMatch: ["**/?(*.)+(spec|test).+(ts|tsx|js)"],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
preset: "ts-jest",
testEnvironment: "node",
};
Loading
Loading