Skip to content

Commit

Permalink
Fx docker template and canary batcher workflow (#4585)
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Oct 19, 2021
1 parent dcfe3f6 commit 3fd8001
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 5 deletions.
72 changes: 70 additions & 2 deletions canary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Echo workflow tests the very basic workflow functionality. It executes an activi

To manually start an `Echo` test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.echo
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.echo -i 0
```
Then observe the progress:
```
Expand All @@ -157,39 +157,107 @@ You can use these command for all other test cases listed below.
### Signal
Signal workflow tests the signal feature.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.signal -i 0
```

### Visibility
Visibility workflow tests the basic visibility feature. No advanced visibility needed, but advanced visibility should also support it.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.visibility -i 0
```

### SearchAttributes
SearchAttributes workflow tests the advanced visibility feature. Make sure advanced visibility feature is configured on the server. Otherwise, it should be excluded from the sanity test suite/case.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.searchAttributes -i 0
```

### ConcurrentExec
ConcurrentExec workflow tests executing activities concurrently.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.concurrent-execution -i 0
```

### Query
Query workflow tests the Query feature.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.query -i 0
```

### Timeout
Timeout workflow make sure the activity timeout is enforced.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.timeout -i 0
```

### LocalActivity
LocalActivity workflow tests the local activity feature.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.localactivity -i 0
```

### Cancellation
Cancellation workflowt tests cancellation feature.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.cancellation -i 0
```

### Retry
Retry workflow tests activity retry policy.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.retry -i 0
```

### Reset
Reset workflow tests reset feature.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.reset -i 0
```

### HistoryArchival
HistoryArchival tests history archival feature. Make sure history archival feature is configured on the server. Otherwise, it should be excluded from the sanity test suite/case.

This test case always uses `canary-archival-domain` domain.

To manually start one run of this test case:
```
cadence --do canary-archival-domain workflow start --tl canary-task-queue --et 10 --wt workflow.timeout -i 0
```

### VisibilityArchival
VisibilityArchival tests visibility archival feature. Make sure visibility feature is configured on the server. Otherwise, it should be excluded from the sanity test suite/case.

This test case always uses `canary-archival-domain` domain.

To manually start one run of this test case:
```
cadence --do canary-archival-domain workflow start --tl canary-task-queue --et 10 --wt workflow.timeout -i 0
```

### Batch
Batch workflow tests the batch job feature. Make sure advanced visibility feature is configured on the server. Otherwise, it should be excluded from the sanity test suite/case.
Batch workflow tests the batch job feature. Make sure advanced visibility feature is configured on the server. Otherwise, it should be excluded from the sanity test suite/case.

To manually start one run of this test case:
```
cadence --do <> workflow start --tl canary-task-queue --et 10 --wt workflow.batch -i 0
```
2 changes: 1 addition & 1 deletion canary/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func batchWorkflowChild(ctx workflow.Context, scheduledTimeNanos int64) error {
}

func startBatchWorkflow(ctx context.Context, domain, startTime string) error {
sdkClient := getContextValue(ctx, ctxKeyActivitySystemClient).(*activityContext).cadence
sdkClient := getContextValue(ctx, ctxKeyActivityBatcherClient).(*activityContext).cadence

params := BatchParams{
DomainName: domain,
Expand Down
8 changes: 7 additions & 1 deletion canary/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"go.uber.org/cadence/.gen/go/shared"
"go.uber.org/cadence/worker"
"go.uber.org/zap"

"github.com/uber/cadence/common"
)

type (
Expand All @@ -41,6 +43,7 @@ type (
canaryDomain string
archivalClient cadenceClient
systemClient cadenceClient
batcherClient cadenceClient
runtime *RuntimeContext
canaryConfig *Canary
}
Expand All @@ -62,12 +65,14 @@ const (
func newCanary(domain string, rc *RuntimeContext, canaryConfig *Canary) Runnable {
canaryClient := newCadenceClient(domain, rc)
archivalClient := newCadenceClient(archivalDomain, rc)
systemClient := newCadenceClient(systemDomain, rc)
systemClient := newCadenceClient(common.SystemLocalDomainName, rc)
batcherClient := newCadenceClient(common.BatcherLocalDomainName, rc)
return &canaryImpl{
canaryClient: canaryClient,
canaryDomain: domain,
archivalClient: archivalClient,
systemClient: systemClient,
batcherClient: batcherClient,
runtime: rc,
canaryConfig: canaryConfig,
}
Expand Down Expand Up @@ -154,6 +159,7 @@ func (c *canaryImpl) newActivityContext() context.Context {
ctx := context.WithValue(context.Background(), ctxKeyActivityRuntime, &activityContext{cadence: c.canaryClient})
ctx = context.WithValue(ctx, ctxKeyActivityArchivalRuntime, &activityContext{cadence: c.archivalClient})
ctx = context.WithValue(ctx, ctxKeyActivitySystemClient, &activityContext{cadence: c.systemClient})
ctx = context.WithValue(ctx, ctxKeyActivityBatcherClient, &activityContext{cadence: c.batcherClient})
ctx = context.WithValue(ctx, ctxKeyConfig, c.canaryConfig)
return overrideWorkerOptions(ctx)
}
Expand Down
2 changes: 1 addition & 1 deletion canary/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const (
ctxKeyActivityRuntime = "runtime"
ctxKeyActivityArchivalRuntime = "runtime-archival"
ctxKeyActivitySystemClient = "system-client"
ctxKeyActivityBatcherClient = "batcher-client"
ctxKeyConfig = "runtime-config"
archivalDomain = "canary-archival-domain"
systemDomain = "cadence-system"
archivalTaskListName = "canary-archival-task-queue"
)

Expand Down
2 changes: 2 additions & 0 deletions docker/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ services:

clusterGroupMetadata:
enableGlobalDomain: {{ default .Env.ENABLE_GLOBAL_DOMAIN "true" }}
clusterRedirectionPolicy:
policy: {{ default .Env.CLUSTER_REDIRECT_POLICY "all-domain-apis-forwarding" }}
failoverVersionIncrement: 10
primaryClusterName: "primary"
{{- if .Env.IS_NOT_PRIMARY }}
Expand Down

0 comments on commit 3fd8001

Please sign in to comment.