Skip to content

Commit 8c5c0ef

Browse files
committed
test dbos mocks
1 parent 574621c commit 8c5c0ef

File tree

10 files changed

+2036
-6
lines changed

10 files changed

+2036
-6
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ jobs:
6060
- name: Install gotestsum
6161
run: go install gotest.tools/gotestsum@latest
6262

63+
- name: Install mockery
64+
run: go install github.com/vektra/mockery/v3@latest
65+
66+
- name: Generate mocks
67+
run: go generate ./...
68+
working-directory: ./dbos
69+
6370
- name: Run tests
6471
run: go vet ./... && gotestsum --format github-action -- -race -v -count=1 ./...
6572
working-directory: ./dbos

cmd/dbos/init.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ var initCmd = &cobra.Command{
1616
RunE: runInit,
1717
}
1818

19-
var (
20-
configOnly bool
21-
)
22-
2319
type templateData struct {
2420
ProjectName string
2521
}

dbos/dbos.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func processConfig(inputConfig *Config) (*Config, error) {
9393
return dbosConfig, nil
9494
}
9595

96+
//go:generate mockery --config=mocks-tests-config.yaml
97+
9698
// DBOSContext represents a DBOS execution context that provides workflow orchestration capabilities.
9799
// It extends the standard Go context.Context and adds methods for running workflows and steps,
98100
// inter-workflow communication, and state management.

dbos/mocks-tests-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
all: false
2+
dir: './mocks'
3+
filename: '{{.InterfaceName}}_mock.go'
4+
force-file-write: true
5+
formatter: goimports
6+
include-auto-generated: false
7+
log-level: info
8+
structname: 'Mock{{.InterfaceName}}'
9+
pkgname: 'mocks'
10+
recursive: false
11+
require-template-schema-exists: true
12+
template: testify
13+
template-schema: '{{.Template}}.schema.json'
14+
packages:
15+
github.com/dbos-inc/dbos-transact-golang/dbos:
16+
interfaces:
17+
DBOSContext:
18+
WorkflowHandle:

0 commit comments

Comments
 (0)