Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
80 changes: 42 additions & 38 deletions examples/actor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
name: Run Actor server
output_match_mode: substring
expected_stdout_lines:
- '== APP == call get user req = &{abc 123}'
- '== APP == get req = laurence'
- '== APP == get post request = laurence'
- '== APP == get req = hello'
- '== APP == get req = hello'
- '== APP == receive reminder = testReminderName state = "hello"'
- '== APP == receive reminder = testReminderName state = "hello"'
- 'call get user req = &{abc 123}'
- 'get req = laurence'
- 'get post request = laurence'
- 'get req = hello'
- 'get req = hello'
- 'receive reminder = testReminderName state = "hello"'
- 'receive reminder = testReminderName state = "hello"'
background: true
sleep: 30
timeout_seconds: 60
-->

Expand All @@ -42,19 +41,17 @@ dapr run --app-id actor-serving \
name: Run Actor Client
output_match_mode: substring
expected_stdout_lines:
- '== APP == get user result = &{abc 123}'
- '== APP == get invoke result = laurence'
- '== APP == get post result = laurence'
- '== APP == get result = get result'
- '== APP == start timer'
- '== APP == stop timer'
- '== APP == start reminder'
- '== APP == stop reminder'
- '== APP == get user = {Name: Age:1}'
- '== APP == get user = {Name: Age:2}'
- 'get user result = &{abc 123}'
- 'get invoke result = laurence'
- 'get post result = laurence'
- 'get result = get result'
- 'start timer'
- 'stop timer'
- 'start reminder'
- 'stop reminder'
- 'get user = {Name: Age:1}'
- 'get user = {Name: Age:2}'

background: true
sleep: 40
timeout_seconds: 60
-->

Expand All @@ -69,36 +66,43 @@ dapr run --app-id actor-client \

### Cleanup

<!-- STEP
name: Cleanup actor server
expected_return_code:
-->

```bash
dapr stop --app-id actor-serving
(lsof -i:8080 | grep main) | awk '{print $2}' | xargs kill
```

<!-- END_STEP -->

## Result
- client side
```
== APP == dapr client initializing for: 127.0.0.1:55776
== APP == get user result = &{abc 123}
== APP == get invoke result = laurence
== APP == get post result = laurence
== APP == get result = get result
== APP == start timer
== APP == stop timer
== APP == start reminder
== APP == stop reminder
== APP == get user = {Name: Age:1}
== APP == get user = {Name: Age:2}
dapr client initializing for: 127.0.0.1:55776
get user result = &{abc 123}
get invoke result = laurence
get post result = laurence
get result = get result
start timer
stop timer
start reminder
stop reminder
get user = {Name: Age:1}
get user = {Name: Age:2}
✅ Exited App successfully
```

- server side

```
== APP == call get user req = &{abc 123}
== APP == get req = laurence
== APP == get post request = laurence
== APP == get req = hello
== APP == get req = hello
== APP == receive reminder = testReminderName state = "hello"
== APP == receive reminder = testReminderName state = "hello"
call get user req = &{abc 123}
get req = laurence
get post request = laurence
get req = hello
get req = hello
receive reminder = testReminderName state = "hello"
receive reminder = testReminderName state = "hello"
```
5 changes: 4 additions & 1 deletion examples/actor/serving/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"log"
"net/http"
"os"
"time"

"github.com/dapr/go-sdk/actor"
Expand All @@ -28,6 +29,8 @@ import (
daprd "github.com/dapr/go-sdk/service/http"
)

var logger = log.New(os.Stdout, "", log.LstdFlags)

func testActorFactory() actor.ServerContext {
client, err := dapr.NewClient()
if err != nil {
Expand Down Expand Up @@ -137,6 +140,6 @@ func main() {
s := daprd.NewService(":8080")
s.RegisterActorImplFactoryContext(testActorFactory)
if err := s.Start(); err != nil && err != http.ErrServerClosed {
log.Fatalf("error listenning: %v", err)
logger.Fatalf("error listenning: %v", err)
}
}
52 changes: 26 additions & 26 deletions examples/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ name: Run Configuration Client
output_match_mode: substring
match_order: none
expected_stdout_lines:
- '== APP == got config key = mykey, value = myConfigValue'
- '== APP == got config key = mySubscribeKey1, value = mySubscribeValue1'
- '== APP == got config key = mySubscribeKey2, value = mySubscribeValue1'
- '== APP == got config key = mySubscribeKey3, value = mySubscribeValue1'
- '== APP == got config key = mySubscribeKey1, value = mySubscribeValue2'
- '== APP == got config key = mySubscribeKey2, value = mySubscribeValue2'
- '== APP == got config key = mySubscribeKey3, value = mySubscribeValue2'
- '== APP == got config key = mySubscribeKey1, value = mySubscribeValue3'
- '== APP == got config key = mySubscribeKey2, value = mySubscribeValue3'
- '== APP == got config key = mySubscribeKey3, value = mySubscribeValue3'
- '== APP == dapr configuration subscribe finished.'
- 'got config key = mykey, value = myConfigValue'
- 'got config key = mySubscribeKey1, value = mySubscribeValue1'
- 'got config key = mySubscribeKey2, value = mySubscribeValue1'
- 'got config key = mySubscribeKey3, value = mySubscribeValue1'
- 'got config key = mySubscribeKey1, value = mySubscribeValue2'
- 'got config key = mySubscribeKey2, value = mySubscribeValue2'
- 'got config key = mySubscribeKey3, value = mySubscribeValue2'
- 'got config key = mySubscribeKey1, value = mySubscribeValue3'
- 'got config key = mySubscribeKey2, value = mySubscribeValue3'
- 'got config key = mySubscribeKey3, value = mySubscribeValue3'
- 'dapr configuration subscribe finished.'
background: false
sleep: 40
timeout_seconds: 60
Expand All @@ -50,21 +50,21 @@ The subscription event order may out of order.
```
got config key = mykey, value = myConfigValue

got config key = mySubscribeKey1, value = mySubscribeValue1
got config key = mySubscribeKey2, value = mySubscribeValue1
got config key = mySubscribeKey3, value = mySubscribeValue1
got config key = mySubscribeKey1, value = mySubscribeValue2
got config key = mySubscribeKey2, value = mySubscribeValue2
got config key = mySubscribeKey3, value = mySubscribeValue2
got config key = mySubscribeKey1, value = mySubscribeValue3
got config key = mySubscribeKey2, value = mySubscribeValue3
got config key = mySubscribeKey3, value = mySubscribeValue3
got config key = mySubscribeKey1, value = mySubscribeValue4
got config key = mySubscribeKey2, value = mySubscribeValue4
got config key = mySubscribeKey3, value = mySubscribeValue4
got config key = mySubscribeKey1, value = mySubscribeValue5
got config key = mySubscribeKey2, value = mySubscribeValue5
got config key = mySubscribeKey3, value = mySubscribeValue5
got config key = mySubscribeKey1, value = mySubscribeValue1
got config key = mySubscribeKey2, value = mySubscribeValue1
got config key = mySubscribeKey3, value = mySubscribeValue1
got config key = mySubscribeKey1, value = mySubscribeValue2
got config key = mySubscribeKey2, value = mySubscribeValue2
got config key = mySubscribeKey3, value = mySubscribeValue2
got config key = mySubscribeKey1, value = mySubscribeValue3
got config key = mySubscribeKey2, value = mySubscribeValue3
got config key = mySubscribeKey3, value = mySubscribeValue3
got config key = mySubscribeKey1, value = mySubscribeValue4
got config key = mySubscribeKey2, value = mySubscribeValue4
got config key = mySubscribeKey3, value = mySubscribeValue4
got config key = mySubscribeKey1, value = mySubscribeValue5
got config key = mySubscribeKey2, value = mySubscribeValue5
got config key = mySubscribeKey3, value = mySubscribeValue5
dapr configuration subscribe finished.
dapr configuration unsubscribed
✅ Exited App successfully
Expand Down
4 changes: 2 additions & 2 deletions examples/conversation-alpha1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name: Run Conversation
output_match_mode: substring
expected_stdout_lines:
- '== APP == conversation output: hello world'
- 'conversation output: hello world'

background: true
sleep: 60
Expand All @@ -32,5 +32,5 @@ dapr run --app-id conversation \
## Result

```
- '== APP == conversation output: hello world'
- 'conversation output: hello world'
```
5 changes: 4 additions & 1 deletion examples/conversation-alpha1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ import (
"context"
"fmt"
"log"
"os"

dapr "github.com/dapr/go-sdk/client"
)

var logger = log.New(os.Stdout, "", log.LstdFlags)

func main() {
client, err := dapr.NewClient()
if err != nil {
Expand All @@ -42,7 +45,7 @@ func main() {

resp, err := client.ConverseAlpha1(context.Background(), request)
if err != nil {
log.Fatalf("err: %v", err)
logger.Fatalf("err: %v", err)
}

fmt.Printf("conversation output: %s\n", resp.Outputs[0].Result)
Expand Down
6 changes: 3 additions & 3 deletions examples/conversation-alpha2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
name: Run Conversation
output_match_mode: substring
expected_stdout_lines:
- '== APP == conversation input: hello world'
- '== APP == conversation output: hello world'
- 'conversation input: hello world'
- 'conversation output: hello world'

background: true
sleep: 60
Expand All @@ -33,5 +33,5 @@ dapr run --app-id conversation \
## Result

```
- '== APP == conversation output: hello world'
- 'conversation output: hello world'
```
5 changes: 4 additions & 1 deletion examples/conversation-alpha2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ import (
"context"
"fmt"
"log"
"os"

dapr "github.com/dapr/go-sdk/client"
)

var logger = log.New(os.Stdout, "", log.LstdFlags)

func main() {
client, err := dapr.NewClient()
if err != nil {
Expand Down Expand Up @@ -68,7 +71,7 @@ func main() {

resp, err := client.ConverseAlpha2(context.Background(), request)
if err != nil {
log.Fatalf("err: %v", err)
logger.Fatalf("err: %v", err)
}

fmt.Printf("conversation output: %s\n", resp.Outputs[0].Choices[0].Message.Content)
Expand Down
20 changes: 10 additions & 10 deletions examples/crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ openssl rand -out keys/symmetric-key-256 32
<!-- STEP
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 encrypted data to encrypted.out'
- '== APP == Wrote decrypted data to decrypted.out.jpg'
- 'Encrypted the message, got 856 bytes'
- 'Decrypted the message, got 24 bytes'
- 'The secret is "passw0rd"'
- 'Wrote encrypted data to encrypted.out'
- 'Wrote decrypted data to decrypted.out.jpg'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
Expand All @@ -66,9 +66,9 @@ dapr stop --app-id crypto
## Result

```shell
== APP == Encrypted the message, got 856 bytes
== APP == Decrypted the message, got 24 bytes
== APP == The secret is "passw0rd"
== APP == Wrote encrypted data to encrypted.out
== APP == Wrote decrypted data to decrypted.out.jpg
Encrypted the message, got 856 bytes
Decrypted the message, got 24 bytes
The secret is "passw0rd"
Wrote encrypted data to encrypted.out
Wrote decrypted data to decrypted.out.jpg
```
Loading
Loading