File tree Expand file tree Collapse file tree 3 files changed +44
-12
lines changed Expand file tree Collapse file tree 3 files changed +44
-12
lines changed Original file line number Diff line number Diff line change
1
+ .PHONY : build test test-examples regen
2
+
1
3
build :
2
4
go build ./...
3
5
4
6
test :
5
7
go test ./...
6
8
9
+ test-examples :
10
+ go test --tags=examples ./...
11
+
12
+ regen : sqlc-dev
13
+ go run ./scripts/regenerate/
14
+
7
15
sqlc-dev :
8
16
go build -o ~ /bin/sqlc-dev ./cmd/sqlc/
9
17
10
18
sqlc-pg-gen :
11
19
go build -o ~ /bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen
12
-
13
- regen : sqlc-dev
14
- go run ./scripts/regenerate/
Original file line number Diff line number Diff line change @@ -471,15 +471,24 @@ go build -o ~/go/bin/sqlc-dev ./cmd/sqlc
471
471
472
472
### Running Tests
473
473
474
- To run the tests, include the ` exp ` tag. Without this tag, a few tests will
475
- fail.
474
+ ```
475
+ go test ./...
476
+ ```
477
+
478
+ To run the tests in the examples folder, use the ` examples ` tag.
479
+
480
+ ```
481
+ go test --tags=examples ./...
482
+ ```
483
+
484
+ These tests require locally-running database instances. Run these databases
485
+ using [ Docker Compose] ( https://docs.docker.com/compose/ ) .
476
486
477
487
```
478
- go test --tags=exp ./...
488
+ docker-compose up -d
479
489
```
480
490
481
- To run the tests in the examples folder, a running PostgreSQL instance is
482
- required. The tests use the following environment variables to connect to the
491
+ The tests use the following environment variables to connect to the
483
492
database
484
493
485
494
#### For PostgreSQL
@@ -506,10 +515,6 @@ MYSQL_ROOT_PASSWORD mysecretpassword
506
515
MYSQL_DATABASE dinotest
507
516
```
508
517
509
- ```
510
- go test --tags=examples,exp ./...
511
- ```
512
-
513
518
### Regenerate expected test output
514
519
515
520
If you need to update a large number of expected test output in the
Original file line number Diff line number Diff line change
1
+ version : " 3.8"
2
+ services :
3
+ mysql :
4
+ image : " mysql:8"
5
+ ports :
6
+ - " 3306:3306"
7
+ restart : always
8
+ environment :
9
+ MYSQL_DATABASE : dinotest
10
+ MYSQL_PASSWORD : mysecretpassword
11
+ MYSQL_ROOT_PASSWORD : mysecretpassword
12
+ MYSQL_USER : root
13
+
14
+ postgresql :
15
+ image : " postgres:13"
16
+ ports :
17
+ - " 5432:5432"
18
+ restart : always
19
+ environment :
20
+ POSTGRES_DB : dinotest
21
+ POSTGRES_PASSWORD : mysecretpassword
22
+ POSTGRES_USER : postgres
You can’t perform that action at this time.
0 commit comments