-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test for http invocation (#758)
Signed-off-by: Elena Kolevska <[email protected]>
- Loading branch information
1 parent
f6e28f3
commit cbc632e
Showing
3 changed files
with
106 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Example - Invoke a service | ||
|
||
This example utilizes a receiver and a caller for the `invoke_method` functionality. | ||
|
||
> **Note:** Make sure to use the latest proto bindings | ||
## Pre-requisites | ||
|
||
- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started) | ||
- [Install Python 3.8+](https://www.python.org/downloads/) | ||
|
||
### Install requirements | ||
|
||
You can install dapr SDK package using pip command: | ||
|
||
<!-- STEP | ||
name: Install requirements | ||
--> | ||
|
||
```sh | ||
pip3 install dapr Flask | ||
``` | ||
|
||
<!-- END_STEP --> | ||
|
||
## Run the example | ||
|
||
To run this example, the following code can be utilized: | ||
|
||
Start the receiver: | ||
<!-- STEP | ||
name: Run invoke http example | ||
expected_stdout_lines: | ||
- '== APP == Order received : {"id": 1, "message": "hello world"}' | ||
- '== APP == Order error : {"id": 2, "message": "hello world"}' | ||
background: true | ||
sleep: 5 | ||
--> | ||
|
||
```bash | ||
dapr run --app-id=invoke-receiver --app-port=8088 --app-protocol http -- python3 invoke-receiver.py | ||
``` | ||
<!-- END_STEP --> | ||
|
||
Start the caller: | ||
<!-- STEP | ||
name: Run invoke http example | ||
expected_stdout_lines: | ||
- '== APP == text/html' | ||
- '== APP == {"success": true}' | ||
- '== APP == 200' | ||
- '== APP == error occurred' | ||
- '== APP == MY_CODE' | ||
background: true | ||
sleep: 5 | ||
--> | ||
|
||
```bash | ||
dapr run --app-id=invoke-caller -- python3 invoke-caller.py | ||
``` | ||
<!-- END_STEP --> | ||
|
||
## Cleanup | ||
|
||
<!-- STEP | ||
expected_stdout_lines: | ||
- '✅ app stopped successfully: invoke-receiver' | ||
name: Shutdown dapr | ||
--> | ||
|
||
```bash | ||
dapr stop --app-id invoke-receiver | ||
``` | ||
|
||
<!-- END_STEP --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters