Skip to content

Commit 9775dbb

Browse files
committed
🔧 Update ci config file
1 parent 1a33aff commit 9775dbb

File tree

1 file changed

+17
-59
lines changed
  • backend/src/openarchiefbeheer/conf

1 file changed

+17
-59
lines changed

backend/src/openarchiefbeheer/conf/ci.py

+17-59
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,35 @@
11
import os
22
import warnings
33

4-
os.environ.setdefault("DEBUG", "no")
5-
os.environ.setdefault("SECRET_KEY", "for-testing-purposes-only")
64
os.environ.setdefault("IS_HTTPS", "no")
7-
os.environ.setdefault("ALLOWED_HOSTS", "")
8-
9-
os.environ.setdefault("DB_USER", "jenkins")
10-
os.environ.setdefault("DB_PASSWORD", "jenkins")
11-
# PostgreSQL 9.6: 5432 (default for Jenkins)
12-
os.environ.setdefault("DB_PORT", "5432")
13-
14-
os.environ.setdefault("ENVIRONMENT", "jenkins")
5+
os.environ.setdefault("SECRET_KEY", "dummy")
6+
# Do not log requests in CI/tests:
7+
#
8+
# * overhead making tests slower
9+
# * it conflicts with SimpleTestCase in some cases when the run-time configuration is
10+
# looked up from the django-solo model
11+
os.environ.setdefault("LOG_REQUESTS", "no")
1512

1613
from .base import * # noqa isort:skip
1714

18-
19-
def get_db_name(prefix):
20-
"""
21-
get a reasonable name below Postgres' 63 char name limit
22-
"""
23-
job = os.getenv("JOB_NAME", default="").lower().rsplit("/", 1)[-1]
24-
build = os.getenv("BUILD_NUMBER", default="0")
25-
lim = 63 - 2 - len(prefix) - len(build)
26-
return "{}_{}_{}".format(prefix, job[:lim], build)
27-
28-
29-
DATABASES["default"]["TEST"] = {"NAME": get_db_name("test_openarchiefbeheer")}
30-
31-
LOGGING["loggers"].update(
15+
CACHES.update(
3216
{
33-
"django": {
34-
"handlers": ["django"],
35-
"level": "WARNING",
36-
"propagate": True,
37-
},
17+
"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
18+
# See: https://github.com/jazzband/django-axes/blob/master/docs/configuration.rst#cache-problems
19+
"axes": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"},
3820
}
3921
)
4022

41-
#
42-
# Django-axes
43-
#
44-
AXES_BEHIND_REVERSE_PROXY = (
45-
False # Required to allow FakeRequest and the like to work correctly.
46-
)
47-
48-
# in memory cache and django-axes don't get along.
49-
# https://django-axes.readthedocs.io/en/latest/configuration.html#known-configuration-problems
50-
CACHES = {
51-
"default": {
52-
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
53-
},
54-
"axes": {
55-
"BACKEND": "django.core.cache.backends.dummy.DummyCache",
56-
},
57-
}
23+
# don't spend time on password hashing in tests/user factories
24+
PASSWORD_HASHERS = ["django.contrib.auth.hashers.UnsaltedMD5PasswordHasher"]
5825

59-
ELASTIC_APM["DEBUG"] = True
60-
61-
# disable 2 FA in tests
62-
MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS = AUTHENTICATION_BACKENDS
26+
ENVIRONMENT = "CI"
6327

6428
#
65-
# Jenkins settings
29+
# Django-axes
6630
#
67-
INSTALLED_APPS += [
68-
"django_jenkins",
69-
]
70-
PROJECT_APPS = [app for app in INSTALLED_APPS if app.startswith("openarchiefbeheer.")]
71-
JENKINS_TASKS = (
72-
# 'django_jenkins.tasks.run_pylint', # Pylint < 2.0 does not run on Python 3.7+
73-
# "django_jenkins.tasks.run_pep8", # -> renamed to pycodestyle, but django-jenkins hasn't been updated in 6 years
74-
)
31+
AXES_BEHIND_REVERSE_PROXY = False
32+
7533

7634
# THOU SHALT NOT USE NAIVE DATETIMES
7735
warnings.filterwarnings(

0 commit comments

Comments
 (0)