Skip to content

Commit d1f3e74

Browse files
committed
Update envfile_testing Make command #520
Signed-off-by: Jono Yang <[email protected]>
1 parent ccb6e1c commit d1f3e74

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

Makefile

+6-7
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ envfile:
5050
@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
5151
@echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}
5252

53-
envfile_testing:
54-
@echo "-> Create the .env file and generate a secret key"
55-
@if test -f ${ENV_FILE}; then echo ".env file exists already"; exit 1; fi
56-
@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
57-
@echo SECRET_KEY=\"${GET_SECRET_KEY}\" >> ${ENV_FILE}
58-
@echo SCANCODEIO_DB_PORT=\"5433\" >> ${ENV_FILE}
53+
envfile_testing: envfile
54+
@echo PACKAGEDB_DB_USER=\"postgres\" >> ${ENV_FILE}
55+
@echo PACKAGEDB_DB_PASSWORD=\"postgres\" >> ${ENV_FILE}
56+
@echo SCANCODEIO_DB_USER=\"postgres\" >> ${ENV_FILE}
57+
@echo SCANCODEIO_DB_PASSWORD=\"postgres\" >> ${ENV_FILE}
5958

6059
isort:
6160
@echo "-> Apply isort changes to ensure proper imports ordering"
@@ -126,7 +125,7 @@ run_map:
126125

127126
test:
128127
@echo "-> Run the test suite"
129-
${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -vvs --ignore matchcode_pipeline --ignore matchcode_project --ignore purldb-toolkit --ignore packagedb/tests/test_throttling.py
128+
${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -x -vvs --ignore matchcode_pipeline --ignore matchcode_project --ignore purldb-toolkit --ignore packagedb/tests/test_throttling.py
130129
${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -vvs packagedb/tests/test_throttling.py
131130
${ACTIVATE} DJANGO_SETTINGS_MODULE=matchcode_project.settings ${PYTHON_EXE} -m pytest -vvs matchcode_pipeline
132131
${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs purldb-toolkit/

azure-pipelines.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77

88
resources:
99
containers:
10-
- container: postgres
11-
image: postgres
12-
env:
13-
POSTGRES_DB: packagedb
14-
POSTGRES_USER: packagedb
15-
POSTGRES_PASSWORD: packagedb
16-
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8"
17-
ports:
18-
- 5432:5432
10+
- container: postgres
11+
image: postgres:13
12+
env:
13+
POSTGRES_USER: postgres
14+
POSTGRES_PASSWORD: postgres
15+
ports:
16+
- 5432:5432
1917

2018
jobs:
2119

etc/ci/azure-posix.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
test_suite_label: ${{ tsuite.key }}
1919
test_suite: ${{ tsuite.value }}
2020

21+
services:
22+
postgres: postgres
23+
2124
steps:
2225
- checkout: self
2326
fetchDepth: 10
@@ -31,7 +34,7 @@ jobs:
3134

3235
- script: |
3336
make dev
34-
make envfile_testing
37+
make envfile
3538
sudo mkdir /etc/scancodeio
3639
sudo cp .env /etc/scancodeio
3740
displayName: '${{ pyver }} - Configure'

purldb_project/settings.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
ENV_FILE = "/etc/purldb/.env"
2525
if not Path(ENV_FILE).exists():
2626
ENV_FILE = ROOT_DIR / ".env"
27-
27+
print(ENV_FILE)
2828
env = environ.Env()
2929
environ.Env.read_env(str(ENV_FILE))
3030

@@ -107,7 +107,8 @@
107107
)
108108

109109
# Database
110-
110+
print(env.str('PACKAGEDB_DB_USER', 'packagedb'))
111+
print(env.str('PACKAGEDB_DB_PASSWORD', 'packagedb'))
111112
DATABASES = {
112113
'default': {
113114
'ENGINE': env.str('PACKAGEDB_DB_ENGINE', 'django.db.backends.postgresql'),

0 commit comments

Comments
 (0)