Skip to content

Commit 59f6cee

Browse files
committed
Do not hard-code PostgreSQL credentials in tester file
This allows running tests against non-default installs
1 parent 8ac1501 commit 59f6cee

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

.drone.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ pipeline:
164164
pull: true
165165
group: test
166166
environment:
167+
PGHOST: pgsql
168+
PGPORT: '5432'
169+
PGUSER: postgres
170+
PGPASSWORD: postgres
167171
TAGS: bindata
168172
GOPATH: /srv/app
169173
commands:

Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ TEST_MYSQL_HOST ?= mysql:3306
3434
TEST_MYSQL_DBNAME ?= testgitea
3535
TEST_MYSQL_USERNAME ?= root
3636
TEST_MYSQL_PASSWORD ?=
37-
TEST_PGSQL_HOST ?= pgsql:5432
38-
TEST_PGSQL_DBNAME ?= testgitea
39-
TEST_PGSQL_USERNAME ?= postgres
40-
TEST_PGSQL_PASSWORD ?= postgres
4137

4238
ifeq ($(OS), Windows_NT)
4339
EXECUTABLE := gitea.exe
@@ -67,7 +63,7 @@ clean:
6763
integrations*.test \
6864
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ \
6965
integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite \
70-
integrations/mysql.ini integrations/pgsql.ini
66+
integrations/mysql.ini
7167

7268
.PHONY: fmt
7369
fmt:
@@ -167,11 +163,6 @@ generate-ini:
167163
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
168164
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
169165
integrations/mysql.ini.tmpl > integrations/mysql.ini
170-
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
171-
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
172-
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
173-
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
174-
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
175166

176167
.PHONY: test-mysql
177168
test-mysql: integrations.test generate-ini

integrations/pgsql.ini.tmpl renamed to integrations/pgsql.ini

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ RUN_MODE = prod
33

44
[database]
55
DB_TYPE = postgres
6-
HOST = {{TEST_PGSQL_HOST}}
7-
NAME = {{TEST_PGSQL_DBNAME}}
8-
USER = {{TEST_PGSQL_USERNAME}}
9-
PASSWD = {{TEST_PGSQL_PASSWORD}}
6+
NAME = testgitea
107
SSL_MODE = disable
11-
PATH = data/gitea.db
128

139
[indexer]
1410
ISSUE_INDEXER_PATH = integrations/indexers-pgsql/issues.bleve

0 commit comments

Comments
 (0)