Skip to content

Commit 784fcda

Browse files
authored
Kitchensink test (#180)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed <!-- Describe what has changed in this PR --> Framework for checking kitchensink actions across SDKs. (more tests to be added later ...) ## Why? <!-- Tell your future self why have you made these changes --> To ensure actions are supported correctly and comprehensively; and document missing implementations. Especially for new actions this helps ensure you've implemented them correctly. ## Checklist <!--- add/delete as needed ---> 1. Closes <!-- add issue number here --> 2. How was this tested: <!--- Please describe how you tested your changes/how we can test them --> 3. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
1 parent aa6de40 commit 784fcda

31 files changed

+804
-163
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on: # rebuild any PRs and main branch changes
1010
- main
1111

1212
jobs:
13-
shellcheck:
13+
lint-shell:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout repo
@@ -22,132 +22,141 @@ jobs:
2222
format: gcc
2323
severity: error
2424

25-
build-lint-test-go:
25+
test-omes:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- name: Print build information
29-
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
3028
- name: Checkout repo
3129
uses: actions/checkout@v4
32-
- name: Install mise
33-
30+
- uses: actions/setup-go@v4
3431
with:
35-
version: ${{ env.MISE_VERSION }}
36-
- name: Install Go
37-
run: ./scripts/install-go.sh
38-
- name: Lint Go
39-
run: |
40-
./scripts/lint-go-worker.sh
41-
- name: Check Go formatting
32+
go-version-file: 'go.mod'
33+
- name: Run tests
4234
run: |
43-
git diff --exit-code || (echo "Go worker has uncommitted formatting changes after linting" && exit 1)
44-
- name: Build Go worker
45-
run: |
46-
./scripts/build-go-worker.sh
35+
go test -race ./...
4736
48-
build-lint-test-java:
37+
lint-worker:
4938
runs-on: ubuntu-latest
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
sdk: [go, java, python, typescript, dotnet]
43+
include:
44+
- sdk: go
45+
install: ./scripts/install-go.sh
46+
lint: ./scripts/lint-go-worker.sh
47+
submodules: false
48+
- sdk: java
49+
install: ./scripts/install-java.sh && ./scripts/install-go.sh
50+
lint: ./scripts/lint-java-worker.sh
51+
submodules: false
52+
- sdk: python
53+
install: ./scripts/install-python.sh && ./scripts/install-go.sh
54+
lint: ./scripts/lint-python-worker.sh
55+
submodules: false
56+
- sdk: typescript
57+
install: ./scripts/install-node.sh && ./scripts/install-go.sh
58+
lint: ./scripts/lint-typescript-worker.sh
59+
submodules: true
60+
- sdk: dotnet
61+
install: ./scripts/install-dotnet.sh && ./scripts/install-go.sh
62+
lint: ./scripts/lint-dotnet-worker.sh
63+
submodules: true
5064
steps:
5165
- name: Print build information
5266
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
5367
- name: Checkout repo
5468
uses: actions/checkout@v4
55-
- name: Install mise
56-
5769
with:
58-
version: ${{ env.MISE_VERSION }}
59-
- name: Install Tools
60-
run: |
61-
./scripts/install-java.sh
62-
./scripts/install-go.sh
63-
- name: Lint Java
64-
run: |
65-
./scripts/lint-java-worker.sh
66-
- name: Check Java formatting
67-
run: |
68-
git diff --exit-code || (echo "Java worker has uncommitted formatting changes after linting" && exit 1)
69-
- name: Build Java worker
70-
run: |
71-
./scripts/build-java-worker.sh
72-
73-
build-lint-test-python:
74-
runs-on: ubuntu-latest
75-
steps:
76-
- name: Print build information
77-
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
78-
- name: Checkout repo
79-
uses: actions/checkout@v4
70+
submodules: ${{ matrix.submodules }}
8071
- name: Install mise
8172
8273
with:
8374
version: ${{ env.MISE_VERSION }}
8475
- name: Install Tools
76+
run: ${{ matrix.install }}
77+
- name: Lint ${{ matrix.sdk }}
78+
run: ${{ matrix.lint }}
79+
- name: Check formatting
8580
run: |
86-
./scripts/install-python.sh
87-
./scripts/install-go.sh
88-
- name: Lint Python
89-
run: |
90-
./scripts/lint-python-worker.sh
91-
- name: Check Python formatting
92-
run: |
93-
git diff --exit-code || (echo "Python worker has uncommitted formatting changes after linting" && exit 1)
94-
- name: Build Python worker
95-
run: |
96-
./scripts/build-python-worker.sh
81+
git diff --exit-code || (echo "${{ matrix.sdk }} worker has uncommitted formatting changes after linting" && exit 1)
9782
98-
build-lint-test-typescript:
83+
build-worker:
9984
runs-on: ubuntu-latest
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
sdk: [go, java, python, typescript, dotnet]
89+
include:
90+
- sdk: go
91+
install: ./scripts/install-go.sh
92+
build: ./scripts/build-go-worker.sh
93+
submodules: false
94+
- sdk: java
95+
install: ./scripts/install-java.sh && ./scripts/install-go.sh
96+
build: ./scripts/build-java-worker.sh
97+
submodules: false
98+
- sdk: python
99+
install: ./scripts/install-python.sh && ./scripts/install-go.sh
100+
build: ./scripts/build-python-worker.sh
101+
submodules: false
102+
- sdk: typescript
103+
install: ./scripts/install-node.sh && ./scripts/install-go.sh
104+
build: ./scripts/build-typescript-worker.sh
105+
submodules: true
106+
- sdk: dotnet
107+
install: ./scripts/install-dotnet.sh && ./scripts/install-go.sh
108+
build: ./scripts/build-dotnet-worker.sh
109+
submodules: true
100110
steps:
101-
- name: Print build information
102-
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
103111
- name: Checkout repo
104112
uses: actions/checkout@v4
105113
with:
106-
submodules: 'true'
114+
submodules: ${{ matrix.submodules }}
107115
- name: Install mise
108116
109117
with:
110118
version: ${{ env.MISE_VERSION }}
111119
- name: Install Tools
112-
run: |
113-
./scripts/install-node.sh
114-
./scripts/install-go.sh
115-
- name: Lint TypeScript
116-
run: |
117-
./scripts/lint-typescript-worker.sh
118-
- name: Check TypeScript formatting
119-
run: |
120-
git diff --exit-code || (echo "TypeScript worker has uncommitted formatting changes after linting" && exit 1)
121-
- name: Build TypeScript worker
122-
run: |
123-
./scripts/build-typescript-worker.sh
120+
run: ${{ matrix.install }}
121+
- name: Build ${{ matrix.sdk }} worker
122+
run: ${{ matrix.build }}
124123

125-
build-lint-test-dotnet:
124+
test-kitchensink:
126125
runs-on: ubuntu-latest
126+
strategy:
127+
fail-fast: false
128+
matrix:
129+
sdk: [go, java, python, typescript, dotnet]
130+
include:
131+
- sdk: go
132+
install: ./scripts/install-go.sh
133+
submodules: false
134+
- sdk: java
135+
install: ./scripts/install-java.sh && ./scripts/install-go.sh
136+
submodules: false
137+
- sdk: python
138+
install: ./scripts/install-python.sh && ./scripts/install-go.sh
139+
submodules: false
140+
- sdk: typescript
141+
install: ./scripts/install-node.sh && ./scripts/install-go.sh
142+
submodules: true
143+
- sdk: dotnet
144+
install: ./scripts/install-dotnet.sh && ./scripts/install-go.sh
145+
submodules: true
127146
steps:
128-
- name: Print build information
129-
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
130147
- name: Checkout repo
131148
uses: actions/checkout@v4
132149
with:
133-
submodules: 'true'
150+
submodules: ${{ matrix.submodules }}
134151
- name: Install mise
135152
136153
with:
137154
version: ${{ env.MISE_VERSION }}
138155
- name: Install Tools
156+
run: ${{ matrix.install }}
157+
- name: Test Kitchensink ${{ matrix.sdk }}
139158
run: |
140-
./scripts/install-dotnet.sh
141-
./scripts/install-go.sh
142-
- name: Lint .NET
143-
run: |
144-
./scripts/lint-dotnet-worker.sh
145-
- name: Check .NET formatting
146-
run: |
147-
git diff --exit-code || (echo ".NET worker has uncommitted formatting changes after linting" && exit 1)
148-
- name: Build .NET worker
149-
run: |
150-
./scripts/build-dotnet-worker.sh
159+
SDK=${{ matrix.sdk }} go test -race ./loadgen -run TestKitchensink -v
151160
152161
build-ks-gen-and-ensure-protos-up-to-date:
153162
runs-on: ubuntu-latest

.github/workflows/docker-images.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- uses: actions/setup-go@v4
5656
if: ${{ !inputs.do-push || github.event.pull_request.head.repo.fork }}
5757
with:
58-
go-version: '^1.24'
58+
go-version-file: 'go.mod'
5959

6060
- name: Set up Docker Buildx
6161
if: ${{ !inputs.do-push || github.event.pull_request.head.repo.fork }}
@@ -110,7 +110,7 @@ jobs:
110110

111111
- uses: actions/setup-go@v4
112112
with:
113-
go-version: '^1.24'
113+
go-version-file: 'go.mod'
114114

115115
- name: Set up Docker Buildx
116116
uses: docker/setup-buildx-action@v3

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ workers/java/build
1818
/last_fuzz_run.proto
1919
workers/dotnet/Temporalio.Omes.temp.csproj
2020

21-
omes-temp-*/
21+
workers/*/omes-temp-*/
22+
workers/*/prepared/
23+
2224
temporal-omes

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ to test a wide variety of scenarios without having to imagine all possible edge
243243
come up in workflows. Input may be saved for regression testing, or hand written for specific cases.
244244

245245
Build by running `scripts/build-kitchensink.sh`.
246+
Test by running `go test -v ./loadgen -run TestKitchensink`.
247+
Prefix with env variable `SDK=<sdk>` to test a specific SDK only.
246248

247249
### Scenario Failure
248250

cmd/build_worker_image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (b *workerImageBuilder) build(ctx context.Context, allowPush bool) error {
176176
for _, arg := range buildArgs {
177177
args = append(args, "--build-arg", arg)
178178
}
179-
args = append(args, rootDir())
179+
args = append(args, repoDir())
180180
b.logger.Infof("Running: docker %v", strings.Join(args, " "))
181181
if b.dryRun {
182182
return nil

cmd/cmdoptions/scenario.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,13 @@ import (
99
)
1010

1111
type ScenarioID struct {
12-
scenario string
13-
runID string
12+
Scenario string
13+
RunID string
1414
}
1515

1616
func (r *ScenarioID) AddCLIFlags(fs *pflag.FlagSet) {
17-
fs.StringVar(&r.scenario, "scenario", "", "Scenario name to run")
18-
fs.StringVar(&r.runID, "run-id", shortRand(), "Run ID for this run")
19-
}
20-
21-
func (r *ScenarioID) Scenario() string {
22-
return r.scenario
23-
}
24-
25-
func (r *ScenarioID) RunID() string {
26-
return r.runID
17+
fs.StringVar(&r.Scenario, "scenario", "", "Scenario name to run")
18+
fs.StringVar(&r.RunID, "run-id", shortRand(), "Run ID for this run")
2719
}
2820

2921
func shortRand() string {

cmd/prepare_worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func prepareWorkerCmd() *cobra.Command {
1919
b.preRun()
2020
},
2121
Run: func(cmd *cobra.Command, args []string) {
22-
baseDir := filepath.Join(rootDir(), "workers", b.SdkOptions.Language.String())
22+
baseDir := workers.BaseDir(repoDir(), b.SdkOptions.Language)
2323
if _, err := b.Build(cmd.Context(), baseDir); err != nil {
2424
b.Logger.Fatal(err)
2525
}
@@ -46,7 +46,7 @@ func (b *workerBuilder) preRun() {
4646
b.Logger = b.loggingOptions.MustCreateLogger()
4747
}
4848

49-
func rootDir() string {
49+
func repoDir() string {
5050
_, currFile, _, _ := runtime.Caller(0)
5151
return filepath.Dir(filepath.Dir(currFile))
5252
}

cmd/run_scenario.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ func (r *scenarioRunner) preRun() {
8686
}
8787

8888
func (r *scenarioRunner) run(ctx context.Context) error {
89-
scenario := loadgen.GetScenario(r.scenario.Scenario())
89+
scenario := loadgen.GetScenario(r.scenario.Scenario)
9090
if scenario == nil {
9191
return fmt.Errorf("scenario not found")
92-
} else if r.scenario.RunID() == "" {
92+
} else if r.scenario.RunID == "" {
9393
return fmt.Errorf("run ID not found")
9494
} else if r.iterations > 0 && r.duration > 0 {
9595
return fmt.Errorf("cannot provide both iterations and duration")
@@ -114,7 +114,6 @@ func (r *scenarioRunner) run(ctx context.Context) error {
114114
value = string(data)
115115
}
116116
scenarioOptions[key] = value
117-
118117
}
119118

120119
metrics := r.metricsOptions.MustCreateMetrics(r.logger)
@@ -137,8 +136,8 @@ func (r *scenarioRunner) run(ctx context.Context) error {
137136
defer client.Close()
138137

139138
scenarioInfo := loadgen.ScenarioInfo{
140-
ScenarioName: r.scenario.Scenario(),
141-
RunID: r.scenario.RunID(),
139+
ScenarioName: r.scenario.Scenario,
140+
RunID: r.scenario.RunID,
142141
Logger: r.logger,
143142
MetricsHandler: metrics.NewHandler(),
144143
Client: client,
@@ -152,7 +151,7 @@ func (r *scenarioRunner) run(ctx context.Context) error {
152151
},
153152
ScenarioOptions: scenarioOptions,
154153
Namespace: r.clientOptions.Namespace,
155-
RootPath: rootDir(),
154+
RootPath: repoDir(),
156155
}
157156
err = scenario.Executor.Run(ctx, scenarioInfo)
158157
if err != nil {

cmd/run_scenario_with_worker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/spf13/cobra"
88
"github.com/spf13/pflag"
99
"github.com/temporalio/omes/cmd/cmdoptions"
10+
"github.com/temporalio/omes/workers"
1011
)
1112

1213
func runScenarioWithWorkerCmd() *cobra.Command {
@@ -54,7 +55,7 @@ func (r *workerWithScenarioRunner) run(ctx context.Context) error {
5455
workerErrCh := make(chan error, 1)
5556
workerStartCh := make(chan struct{})
5657
r.OnWorkerStarted = func() { close(workerStartCh) }
57-
go func() { workerErrCh <- r.Run(ctx, rootDir()) }()
58+
go func() { workerErrCh <- r.Run(ctx, workers.BaseDir(repoDir(), r.SdkOptions.Language)) }()
5859
select {
5960
case err := <-workerErrCh:
6061
return fmt.Errorf("worker did not start: %w", err)

0 commit comments

Comments
 (0)