Я пытаюсь запустить тесты с использованием конвейеров bitbucket, но, к сожалению, я не могу соединиться с postgresql.
Поэтому я попытался добавить rm -rf /tmp/.s.PGSQL.5432/
в свой bitbucket-pipeline.yml, но ничего не изменилось при запуске моегоtest
Это ошибка, которую я получаю
+ python manage.py test
/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:265: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the first PostgreSQL database instead.
RuntimeWarning
nosetests --with-coverage --cover-package=accounts,rest_v1, property --verbosity=1
Creating test database for alias 'default'...
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 174, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
bitbucket-pipelines.yml
image: python:3.6.2
pipelines:
default:
- step:
script:
- pip install -r requirements.txt
- python manage.py test
branches:
develop:
- step:
caches:
- node
script:
- pip install -r requirements.txt
- python manage.py test
setting.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db_name',
'USER': 'user_name',
'PASSWORD': 'db_password',
}
}
Iожидаем, что конвейеры с битовой корзиной выполнят тест без проблем, особенно проблем с подключением к БД