Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit26490ae

Browse files
authored
chore: improve postgres test time by removing cleanup (#7522)
We don't need to delete databases on cleanup... and we don't need toalways run without a cache either!
1 parent778cb74 commit26490ae

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

‎Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,8 @@ test-postgres: test-clean test-postgres-docker
608608
--jsonfile="gotests.json"\
609609
--packages="./..." --\
610610
-covermode=atomic -coverprofile="gotests.coverage" -timeout=20m\
611-
-parallel=4\
612611
-coverpkg=./...\
613-
-count=1 -race -failfast
612+
-race -failfast
614613
.PHONY: test-postgres
615614

616615
test-postgres-docker:
@@ -627,6 +626,8 @@ test-postgres-docker:
627626
--detach\
628627
postgres:13\
629628
-c shared_buffers=1GB\
629+
-c work_mem=1GB\
630+
-c effective_cache_size=1GB\
630631
-c max_connections=1000\
631632
-c fsync=off\
632633
-c synchronous_commit=off\

‎coderd/database/postgres/postgres.go‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@ func Open() (string, func(), error) {
4646
return"",nil,xerrors.Errorf("create db with template: %w",err)
4747
}
4848

49-
deleteDB:=func() {
50-
ddb,_:=sql.Open("postgres",dbURL)
51-
deferddb.Close()
52-
_,_=ddb.Exec("DROP DATABASE "+dbName)
53-
}
54-
55-
return"postgres://postgres:postgres@127.0.0.1:5432/"+dbName+"?sslmode=disable",deleteDB,nil
49+
return"postgres://postgres:postgres@127.0.0.1:5432/"+dbName+"?sslmode=disable",func() {
50+
// We don't need to clean anything up here... it's just a database in a container,
51+
// so cleaning up the container will clean up the database.
52+
},nil
5653
}
5754

5855
pool,err:=dockertest.NewPool("")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp