Skip to content

Commit 468e579

Browse files
authored
Mocks integration (#119)
This PR moves the mocks testing (and, crucially, the generate `mocks` package) outside of the main `dbos` package. This prevents `go` tools from wanting this package when building the dbos library.
1 parent ec81187 commit 468e579

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,26 @@ jobs:
6464
run: go install github.com/vektra/mockery/v3@latest
6565

6666
- name: Generate mocks
67-
run: go generate ./...
68-
working-directory: ./dbos
67+
run: mockery
68+
working-directory: ./integration
6969

70-
- name: Run tests
70+
- name: Run integration tests
7171
run: go vet ./... && gotestsum --format github-action -- -race -v -count=1 ./...
72-
working-directory: ./dbos
72+
working-directory: ./integration
7373
env:
7474
PGPASSWORD: a!b@c$d()e*_,/:;=?@ff[]22
7575
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7676

7777
- name: Run CLI tests
7878
run: go vet ./... && gotestsum --format github-action -- -race -v -count=1 ./...
7979
working-directory: ./cmd/dbos
80+
env:
81+
PGPASSWORD: a!b@c$d()e*_,/:;=?@ff[]22
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Run tests
85+
run: go vet ./... && gotestsum --format github-action -- -race -v -count=1 ./...
86+
working-directory: ./dbos
8087
env:
8188
PGPASSWORD: a!b@c$d()e*_,/:;=?@ff[]22
8289
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dbos/dbos.go

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

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

integration/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mocks/
File renamed without changes.

dbos/mocks_test.go renamed to integration/mocks_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"testing"
77
"time"
88

9+
"github.com/dbos-inc/dbos-transact-golang/integration/mocks"
10+
911
"github.com/dbos-inc/dbos-transact-golang/dbos"
10-
"github.com/dbos-inc/dbos-transact-golang/dbos/mocks"
1112
"github.com/stretchr/testify/mock"
1213
)
1314

@@ -198,5 +199,6 @@ func TestMocks(t *testing.T) {
198199

199200
mockCtx.AssertExpectations(t)
200201
mockChildHandle.AssertExpectations(t)
201-
// mockGenericHandle.AssertExpectations(t)
202+
mockGenericHandle.AssertExpectations(t)
203+
fmt.Println("TestMocks completed successfully")
202204
}

0 commit comments

Comments
 (0)