fix: add crypto validation example and fix mechanical markdown (#544)

* fix: add crypto validation example and fix mechanical markdown

Signed-off-by: mikeee <hey@mike.ee>

* fix: update test assertion and remove cleanup step

Signed-off-by: mikeee <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
This commit is contained in:
Mike Nguyen 2024-05-06 08:35:18 +01:00 committed by GitHub
parent b2ead493ac
commit 0c60bbd3a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View File

@ -158,6 +158,7 @@ jobs:
[
"actor",
"configuration",
"crypto",
"grpc-service",
"hello-world",
"pubsub",

View File

@ -1,6 +1,6 @@
# Dapr Crypto Example with go-sdk
## Step
## Steps
### Prepare
@ -8,8 +8,18 @@
> In order to run this sample, make sure that OpenSSL is available on your system.
### Running
This sample requires a private RSA key and a 256-bit symmetric (AES) key. We will generate them using OpenSSL:
1. This sample requires a private RSA key and a 256-bit symmetric (AES) key. We will generate them using OpenSSL:
<!-- STEP
name: Generate crypto
expected_stderr_lines:
output_match_mode: substring
background: false
sleep: 5
timeout_seconds: 30
-->
```bash
mkdir -p keys
@ -21,19 +31,21 @@ openssl rand -out keys/symmetric-key-256 32
<!-- END_STEP -->
3. Run the Go service app with Dapr:
2. Run the Go service app with Dapr:
<!-- STEP
name: Run crypto service
name: Run crypto example
expected_stdout_lines:
- '== APP == Encrypted the message, got 856 bytes'
- '== APP == Decrypted the message, got 24 bytes'
- '== APP == The secret is "passw0rd"'
- '== APP == Wrote decrypted data to encrypted.out'
- '== APP == Wrote encrypted data to encrypted.out'
- '== APP == Wrote decrypted data to decrypted.out.jpg'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
sleep: 30
timeout_seconds: 90
-->
```bash
@ -44,20 +56,13 @@ dapr run --app-id crypto --resources-path ./components/ -- go run .
### Cleanup
<!-- STEP
expected_stdout_lines:
- '✅ app stopped successfully: crypto'
expected_stderr_lines:
name: Shutdown dapr
-->
`ctrl + c` to stop execution
```bash
dapr stop --app-id crypto
(lsof -i:8080 | grep crypto) | awk '{print $2}' | xargs kill
```
<!-- END_STEP -->
## Result
```shell