chore: Update test docs to postgresql; remove extraneous sqlite stuff (#5400)
* chore: Update test docs to postgresql; remove extraneous sqlite stuff * Reverted addition of settings_postgrestest.py to .gitignore
This commit is contained in:
parent
01b4a91bfe
commit
0f1a6c960f
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
|
@ -48,7 +48,7 @@
|
|||
"args": [
|
||||
"${workspaceFolder}/ietf/manage.py",
|
||||
"test",
|
||||
"--settings=settings_local_sqlitetest"
|
||||
"--settings=settings_postgrestest"
|
||||
],
|
||||
"group": "test",
|
||||
"presentation": {
|
||||
|
@ -68,7 +68,7 @@
|
|||
"args": [
|
||||
"${workspaceFolder}/ietf/manage.py",
|
||||
"test",
|
||||
"--settings=settings_local_sqlitetest",
|
||||
"--settings=settings_postgrestest",
|
||||
"--pattern=tests_js.py"
|
||||
],
|
||||
"group": "test",
|
||||
|
|
|
@ -202,7 +202,7 @@ before activating a new release.
|
|||
|
||||
From a datatracker container, run the command:
|
||||
```sh
|
||||
./ietf/manage.py test --settings=settings_local_sqlitetest
|
||||
./ietf/manage.py test --settings=settings_postgrestest
|
||||
```
|
||||
|
||||
> You can limit the run to specific tests using the `--pattern` argument.
|
||||
|
|
45
bin/setupenv
45
bin/setupenv
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import requests
|
||||
import sys
|
||||
import stat
|
||||
import shutil
|
||||
|
||||
basedir = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
sys.path.append(basedir)
|
||||
|
||||
shutil.copyfile(os.path.join(basedir, 'docker/settings_local.py'), os.path.join(basedir, 'settings_local.py'))
|
||||
|
||||
from ietf.settings_sqlitetest import * # we don't import from django.conf here, on purpose
|
||||
|
||||
for dir in [ AGENDA_PATH, IDSUBMIT_REPOSITORY_PATH, IDSUBMIT_STAGING_PATH,
|
||||
INTERNET_DRAFT_ARCHIVE_DIR, os.path.dirname(DRAFT_ALIASES_PATH), PHOTOS_DIR,
|
||||
os.path.dirname(os.path.abspath(TEST_GHOSTDRIVER_LOG_PATH)), ]:
|
||||
if not os.path.exists(dir):
|
||||
print("Creating %s" % dir)
|
||||
os.makedirs(dir)
|
||||
|
||||
for path in [ DRAFT_ALIASES_PATH, DRAFT_VIRTUAL_PATH, GROUP_ALIASES_PATH, GROUP_VIRTUAL_PATH, ]:
|
||||
if not os.path.exists(path):
|
||||
print("Setting up %s" % path)
|
||||
dir, fn = os.path.split(path)
|
||||
url = "https://zinfandel.tools.ietf.org/src/db/tmp/%s" % fn
|
||||
r = requests.get(url)
|
||||
if r.status_code == 200:
|
||||
with open(path, "w") as of:
|
||||
of.write(r.text)
|
||||
else:
|
||||
print("Error %s fetching '%s'" % (r.status_code, url))
|
||||
|
||||
path = IDSUBMIT_IDNITS_BINARY
|
||||
if not os.path.exists(path):
|
||||
print("Setting up %s" % path)
|
||||
r = requests.get('https://tools.ietf.org/tools/idnits/idnits')
|
||||
with open(path, 'w') as idnits:
|
||||
idnits.write(r.text)
|
||||
os.chmod(path, 0755)
|
||||
|
|
@ -26,7 +26,7 @@ services:
|
|||
# UID: 1001
|
||||
# GID: 1001
|
||||
# DATADIR: data
|
||||
# DJANGO_SETTINGS_MODULE: settings_sqlitetest
|
||||
# DJANGO_SETTINGS_MODULE: settings_postgrestest
|
||||
|
||||
# Uncomment the next line to use a non-root user for all processes.
|
||||
# user: dev
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
# Copyright The IETF Trust 2010-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# Standard settings except we use SQLite and skip migrations, this is
|
||||
# useful for speeding up tests that depend on the test database, try
|
||||
# for instance:
|
||||
#
|
||||
# ./manage.py test --settings=settings_sqlitetest doc.ChangeStateTestCase
|
||||
#
|
||||
|
||||
import os
|
||||
from ietf.settings import * # pyflakes:ignore
|
||||
from ietf.settings import TEST_CODE_COVERAGE_CHECKER
|
||||
import debug # pyflakes:ignore
|
||||
debug.debug = True
|
||||
|
||||
# Workaround to avoid spending minutes stepping through the migrations in
|
||||
# every test run. The result of this is to use the 'syncdb' way of creating
|
||||
# the test database instead of doing it through the migrations. Taken from
|
||||
# https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
|
||||
|
||||
class DisableMigrations(object):
|
||||
|
||||
def __contains__(self, item):
|
||||
return True
|
||||
|
||||
def __getitem__(self, item):
|
||||
return None
|
||||
|
||||
MIGRATION_MODULES = DisableMigrations()
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': 'test.db',
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
},
|
||||
}
|
||||
|
||||
if TEST_CODE_COVERAGE_CHECKER and not TEST_CODE_COVERAGE_CHECKER._started: # pyflakes:ignore
|
||||
TEST_CODE_COVERAGE_CHECKER.start() # pyflakes:ignore
|
||||
|
||||
NOMCOM_PUBLIC_KEYS_DIR=os.path.abspath("tmp-nomcom-public-keys-dir")
|
||||
|
||||
# Undo any developer-dependent middleware when running the tests
|
||||
MIDDLEWARE = [ c for c in MIDDLEWARE if not c in DEV_MIDDLEWARE ] # pyflakes:ignore
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['context_processors'] = [ p for p in TEMPLATES[0]['OPTIONS']['context_processors'] if not p in DEV_TEMPLATE_CONTEXT_PROCESSORS ] # pyflakes:ignore
|
||||
|
||||
REQUEST_PROFILE_STORE_ANONYMOUS_SESSIONS = False
|
||||
|
||||
IDSUBMIT_IDNITS_BINARY = "/usr/local/bin/idnits"
|
||||
IDSUBMIT_REPOSITORY_PATH = "test/id/"
|
||||
IDSUBMIT_STAGING_PATH = "test/staging/"
|
||||
INTERNET_DRAFT_ARCHIVE_DIR = "test/archive/"
|
||||
INTERNET_ALL_DRAFTS_ARCHIVE_DIR = "test/archive/"
|
||||
RFC_PATH = "test/rfc/"
|
||||
|
||||
AGENDA_PATH = '/assets/www6s/proceedings/'
|
||||
MEETINGHOST_LOGO_PATH = AGENDA_PATH
|
||||
|
||||
USING_DEBUG_EMAIL_SERVER=True
|
||||
EMAIL_HOST='localhost'
|
||||
EMAIL_PORT=2025
|
||||
|
||||
MEDIA_BASE_DIR = 'test'
|
||||
MEDIA_ROOT = MEDIA_BASE_DIR + '/media/'
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
PHOTOS_DIRNAME = 'photo'
|
||||
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME
|
||||
|
||||
DOCUMENT_PATH_PATTERN = '/assets/ietf-ftp/{doc.type_id}/'
|
||||
|
||||
SUBMIT_YANG_CATALOG_MODEL_DIR = '/assets/ietf-ftp/yang/catalogmod/'
|
||||
SUBMIT_YANG_DRAFT_MODEL_DIR = '/assets/ietf-ftp/yang/draftmod/'
|
||||
SUBMIT_YANG_INVAL_MODEL_DIR = '/assets/ietf-ftp/yang/invalmod/'
|
||||
SUBMIT_YANG_IANA_MODEL_DIR = '/assets/ietf-ftp/yang/ianamod/'
|
||||
SUBMIT_YANG_RFC_MODEL_DIR = '/assets/ietf-ftp/yang/rfcmod/'
|
||||
|
||||
DE_GFM_BINARY = '/usr/local/bin/de-gfm'
|
|
@ -54,17 +54,6 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$WORKSPACEDIR/ietf/settings_local_sqlitetest.py" ]; then
|
||||
echo "Setting up a default settings_local_sqlitetest.py ..."
|
||||
cp $WORKSPACEDIR/docker/configs/settings_local_sqlitetest.py $WORKSPACEDIR/ietf/settings_local_sqlitetest.py
|
||||
else
|
||||
echo "Using existing ietf/settings_local_sqlitetest.py file"
|
||||
if ! cmp -s $WORKSPACEDIR/docker/configs/settings_local_sqlitetest.py $WORKSPACEDIR/ietf/settings_local_sqlitetest.py; then
|
||||
echo "NOTE: Differences detected compared to docker/configs/settings_local_sqlitetest.py!"
|
||||
echo "We'll assume you made these deliberately."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$WORKSPACEDIR/ietf/settings_local_vite.py" ]; then
|
||||
echo "Setting up a default settings_local_vite.py ..."
|
||||
cp $WORKSPACEDIR/docker/configs/settings_local_vite.py $WORKSPACEDIR/ietf/settings_local_vite.py
|
||||
|
@ -130,7 +119,7 @@ if [ -z "$EDITOR_VSCODE" ]; then
|
|||
echo
|
||||
echo "to start a development instance of the Datatracker."
|
||||
echo
|
||||
echo " ietf/manage.py test --settings=settings_sqlitetest"
|
||||
echo " ietf/manage.py test --settings=settings_postgrestest"
|
||||
echo
|
||||
echo "to run all the python tests."
|
||||
echo
|
||||
|
|
1
ietf/.gitignore
vendored
1
ietf/.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
/settings_local.py
|
||||
/settings_local.py.bak
|
||||
/settings_local_debug.py
|
||||
/settings_local_sqlitetest.py
|
||||
/settings_local_vite.py
|
||||
/settings_mysqldb.py
|
||||
/settings_postgresqldb.py
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
# Copyright The IETF Trust 2010-2020, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# Standard settings except we use SQLite and skip migrations, this is
|
||||
# useful for speeding up tests that depend on the test database, try
|
||||
# for instance:
|
||||
#
|
||||
# ./manage.py test --settings=settings_sqlitetest doc.ChangeStateTestCase
|
||||
#
|
||||
|
||||
import os
|
||||
from ietf.settings import * # pyflakes:ignore
|
||||
from ietf.settings import TEST_CODE_COVERAGE_CHECKER, BASE_DIR, PHOTOS_DIRNAME
|
||||
import debug # pyflakes:ignore
|
||||
debug.debug = True
|
||||
|
||||
# Use a different hostname, to catch hardcoded values
|
||||
IDTRACKER_BASE_URL = "https://sqlitetest.ietf.org"
|
||||
|
||||
# Workaround to avoid spending minutes stepping through the migrations in
|
||||
# every test run. The result of this is to use the 'syncdb' way of creating
|
||||
# the test database instead of doing it through the migrations. Taken from
|
||||
# https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
|
||||
|
||||
class DisableMigrations(object):
|
||||
|
||||
def __contains__(self, item):
|
||||
return True
|
||||
|
||||
def __getitem__(self, item):
|
||||
return None
|
||||
|
||||
MIGRATION_MODULES = DisableMigrations()
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': 'test.db',
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
},
|
||||
}
|
||||
|
||||
if TEST_CODE_COVERAGE_CHECKER and not TEST_CODE_COVERAGE_CHECKER._started: # pyflakes:ignore
|
||||
TEST_CODE_COVERAGE_CHECKER.start() # pyflakes:ignore
|
||||
|
||||
NOMCOM_PUBLIC_KEYS_DIR=os.path.abspath("tmp-nomcom-public-keys-dir")
|
||||
|
||||
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'test/media/') # pyflakes:ignore
|
||||
MEDIA_URL = '/test/media/'
|
||||
PHOTOS_DIR = MEDIA_ROOT + PHOTOS_DIRNAME # pyflakes:ignore
|
||||
|
||||
# Undo any developer-dependent middleware when running the tests
|
||||
MIDDLEWARE = [ c for c in MIDDLEWARE if not c in DEV_MIDDLEWARE ] # pyflakes:ignore
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['context_processors'] = [ p for p in TEMPLATES[0]['OPTIONS']['context_processors'] if not p in DEV_TEMPLATE_CONTEXT_PROCESSORS ] # pyflakes:ignore
|
||||
|
||||
REQUEST_PROFILE_STORE_ANONYMOUS_SESSIONS = False
|
Loading…
Reference in a new issue