Skip to content

Commit 86fdabd

Browse files
authored
Merge pull request #586 from go-jet/tests-go-mod
Isolate tests into separate go mod
2 parents a0558ce + d4d57b6 commit 86fdabd

10 files changed

Lines changed: 399 additions & 106 deletions

File tree

.circleci/config.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,31 @@ jobs:
142142

143143
- run:
144144
name: Running tests
145-
command: gotestsum --junitfile $TEST_RESULTS/report.xml --format testname -- -tags postgres -coverprofile=cover.out -covermode=atomic -coverpkg=github.com/go-jet/jet/v2/postgres/...,github.com/go-jet/jet/v2/mysql/...,github.com/go-jet/jet/v2/sqlite/...,github.com/go-jet/jet/v2/qrm/...,github.com/go-jet/jet/v2/generator/...,github.com/go-jet/jet/v2/internal/...,github.com/go-jet/jet/v2/stmtcache/... ./...
145+
command: |
146+
COVERPKG="github.com/go-jet/jet/v2/postgres/...,github.com/go-jet/jet/v2/mysql/...,github.com/go-jet/jet/v2/sqlite/...,github.com/go-jet/jet/v2/qrm/...,github.com/go-jet/jet/v2/generator/...,github.com/go-jet/jet/v2/internal/...,github.com/go-jet/jet/v2/stmtcache/..."
147+
148+
gotestsum --junitfile $TEST_RESULTS/root-report.xml --format testname -- \
149+
-coverprofile=root-cover.out \
150+
-covermode=atomic \
151+
-coverpkg="$COVERPKG" \
152+
./...
153+
154+
cd tests
155+
gotestsum --junitfile $TEST_RESULTS/integration-report.xml --format testname -- \
156+
-tags postgres \
157+
-coverprofile=../integration-cover.out \
158+
-covermode=atomic \
159+
-coverpkg="$COVERPKG" \
160+
./...
161+
cd -
162+
163+
head -n 1 root-cover.out > cover.out
164+
tail -n +2 root-cover.out >> cover.out
165+
tail -n +2 integration-cover.out >> cover.out
146166
147167
- run:
148168
name: Running tests with statement caching enabled
149-
command: JET_TESTS_WITH_STMT_CACHE=true go test -tags postgres -v ./tests/...
169+
command: cd tests && JET_TESTS_WITH_STMT_CACHE=true go test -v ./... && cd -
150170

151171
- run:
152172
name: Init databases (mariadb, cockroachdb) and generate jet files
@@ -156,8 +176,8 @@ jobs:
156176
go run ./init/init.go -testsuite cockroach
157177
158178
# run mariaDB and cockroachdb tests. No need to collect coverage, because coverage is already included with mysql and postgres tests
159-
- run: MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/
160-
- run: PG_SOURCE=COCKROACH_DB go test -v ./tests/postgres/
179+
- run: cd tests && MY_SQL_SOURCE=MariaDB go test -v ./mysql/
180+
- run: cd tests && PG_SOURCE=COCKROACH_DB go test -v ./postgres/
161181

162182
- save_cache:
163183
key: go-mod-v4-{{ checksum "go.sum" }}

go.mod

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,29 @@ go 1.24.0
44

55
// used by jet generator
66
require (
7-
github.com/go-sql-driver/mysql v1.9.3
7+
github.com/go-sql-driver/mysql v1.10.0
88
github.com/google/uuid v1.6.0
99
github.com/jackc/pgtype v1.14.4
10-
github.com/jackc/pgx/v5 v5.8.0
11-
github.com/lib/pq v1.10.9
12-
github.com/mattn/go-sqlite3 v1.14.28
10+
github.com/lib/pq v1.12.3
11+
github.com/mattn/go-sqlite3 v1.14.44
1312
)
1413

1514
// used in tests
1615
require (
17-
github.com/bytedance/sonic v1.14.0
1816
github.com/google/go-cmp v0.7.0
19-
github.com/pkg/profile v1.7.0
20-
github.com/shopspring/decimal v1.4.0
2117
github.com/stretchr/testify v1.11.1
22-
github.com/volatiletech/null/v8 v8.1.2
23-
gopkg.in/guregu/null.v4 v4.0.0
2418
)
2519

2620
require (
27-
filippo.io/edwards25519 v1.1.0 // indirect
28-
github.com/bytedance/sonic/loader v0.3.0 // indirect
29-
github.com/cloudwego/base64x v0.1.5 // indirect
21+
filippo.io/edwards25519 v1.2.0 // indirect
3022
github.com/davecgh/go-spew v1.1.1 // indirect
31-
github.com/felixge/fgprof v0.9.3 // indirect
32-
github.com/friendsofgo/errors v0.9.2 // indirect
33-
github.com/gofrs/uuid v4.0.0+incompatible // indirect
34-
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
3523
github.com/jackc/pgio v1.0.0 // indirect
36-
github.com/jackc/pgpassfile v1.0.0 // indirect
3724
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
38-
github.com/jackc/puddle/v2 v2.2.2 // indirect
39-
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
25+
github.com/kr/pretty v0.3.0 // indirect
4026
github.com/pmezard/go-difflib v1.0.0 // indirect
4127
github.com/rogpeppe/go-internal v1.14.1 // indirect
42-
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
43-
github.com/volatiletech/inflect v0.0.1 // indirect
44-
github.com/volatiletech/randomize v0.0.1 // indirect
45-
github.com/volatiletech/strmangle v0.0.1 // indirect
46-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
47-
golang.org/x/crypto v0.35.0 // indirect
48-
golang.org/x/sync v0.17.0 // indirect
49-
golang.org/x/text v0.29.0 // indirect
50-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
28+
golang.org/x/crypto v0.45.0 // indirect
29+
golang.org/x/text v0.31.0 // indirect
30+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
5131
gopkg.in/yaml.v3 v3.0.1 // indirect
5232
)

0 commit comments

Comments
 (0)