|
| 1 | +This example validates the resiliency and does not demonstrate any extra |
| 2 | +functionality. It is based off the configuration example to connect to the |
| 3 | +sidecar and make a call for a configuration item stored in redis. |
| 4 | + |
| 5 | +1. Insert a key with the value `hello` to redis using the following command: |
| 6 | + |
| 7 | + |
| 8 | +<!-- STEP |
| 9 | +name: Insert test configuration item |
| 10 | +output_match_mode: substring |
| 11 | +expected_stdout_lines: |
| 12 | + - 'OK' |
| 13 | +background: false |
| 14 | +sleep: 5 |
| 15 | +timeout_seconds: 5 |
| 16 | +--> |
| 17 | + |
| 18 | +```bash |
| 19 | +docker exec dapr_redis redis-cli MSET hello "world" |
| 20 | +``` |
| 21 | + |
| 22 | +<!-- END_STEP --> |
| 23 | + |
| 24 | +2. Run the example without the sidecar using the following command: |
| 25 | + |
| 26 | +<!-- STEP |
| 27 | +name: Run configuration app (expecting a fail) |
| 28 | +env: |
| 29 | + DAPR_GRPC_PORT: "3500" |
| 30 | + DAPR_API_MAX_RETRIES: "10" |
| 31 | + DAPR_API_TIMEOUT_MILLISECONDS: "10000" |
| 32 | +output_match_mode: substring |
| 33 | +expected_stdout_lines: |
| 34 | + - '' |
| 35 | +expected_stderr_lines: |
| 36 | + - 'TransportError' |
| 37 | +expected_return_code: 101 |
| 38 | +background: false |
| 39 | +sleep: 30 |
| 40 | +timeout_seconds: 30 |
| 41 | +--> |
| 42 | + |
| 43 | +```bash |
| 44 | +cargo run --example resiliency |
| 45 | +``` |
| 46 | + |
| 47 | +<!-- END_STEP --> |
| 48 | + |
| 49 | +The result should be that the request will fail. |
| 50 | + |
| 51 | +3. Run the example without the sidecar (this time in the background) |
| 52 | + |
| 53 | +<!-- STEP |
| 54 | +name: Run configuration app (expecting a success eventually) |
| 55 | +env: |
| 56 | + DAPR_GRPC_PORT: "3500" |
| 57 | + DAPR_API_MAX_RETRIES: "10" |
| 58 | + DAPR_API_TIMEOUT_MILLISECONDS: "10000" |
| 59 | +output_match_mode: substring |
| 60 | +expected_stdout_lines: |
| 61 | + - '== APP == Configuration value: ConfigurationItem { value: "world"' |
| 62 | +background: true |
| 63 | +sleep: 30 |
| 64 | +timeout_seconds: 30 |
| 65 | +--> |
| 66 | + |
| 67 | +```bash |
| 68 | +cargo run --example resiliency |
| 69 | +``` |
| 70 | + |
| 71 | +<!-- END_STEP --> |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +4. Run the Dapr sidecar |
| 76 | + |
| 77 | +<!-- STEP |
| 78 | +name: Run Dapr sidecar |
| 79 | +output_match_mode: substring |
| 80 | +expected_stdout_lines: |
| 81 | + - '' |
| 82 | +background: true |
| 83 | +sleep: 10 |
| 84 | +timeout_seconds: 10 |
| 85 | +--> |
| 86 | + |
| 87 | +```bash |
| 88 | +dapr run --app-id=rustapp --resources-path ../components --dapr-grpc-port 3500 |
| 89 | +``` |
| 90 | + |
| 91 | +<!-- END_STEP --> |
| 92 | + |
| 93 | +The example app should make contact with the Dapr sidecar and the result should |
| 94 | +be returned from the configuration request successfully. |
| 95 | + |
| 96 | +``` |
| 97 | +Configuration value: ConfigurationItem { value: "world", version: "", metadata: {} } |
| 98 | +``` |
0 commit comments