Skip to content

Commit ebaf6b5

Browse files
jennifer-richardsNGPixel
authored andcommitted
ci: quotes around shell parameters
1 parent 48f9080 commit ebaf6b5

3 files changed

Lines changed: 78 additions & 17 deletions

File tree

bin/mrun.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from os import fork, kill, waitpid
2+
from signal import SIGTERM
3+
from subprocess import run
4+
from sys import exit
5+
from time import sleep
6+
7+
num_processes = 50
8+
9+
children = []
10+
11+
def be_a_child():
12+
run(["bin/test-crawl"])
13+
14+
15+
for _ in range(num_processes):
16+
sleep(0.5)
17+
pid = fork()
18+
if pid == 0:
19+
be_a_child()
20+
exit()
21+
children.append(pid)
22+
23+
input("Enter to exit...")
24+
for pid in children:
25+
kill(pid, SIGTERM)
26+
27+
for pid in children:
28+
waitpid(pid, 0)
29+
30+
print("Done")

bin/test-crawl

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ args = parser.parse_args()
6666
# Import Django, call setup()
6767
os.environ.setdefault("DJANGO_SETTINGS_MODULE", args.settings or "ietf.settings_testcrawl")
6868

69-
import django
70-
import django.test
71-
import django.core.checks
72-
from django.conf import settings
73-
from django.utils import timezone
74-
75-
django.setup()
69+
# import django
70+
# import django.test
71+
# import django.core.checks
72+
# from django.conf import settings
73+
# from django.utils import timezone
74+
#
75+
# django.setup()
7676

7777
# This needs to come after we set up sys path to include the local django
78-
import debug # pyflakes:ignore
78+
# import debug # pyflakes:ignore
7979

8080
# prevent memory from leaking when settings.DEBUG=True
8181
# from django.db import connection
@@ -84,7 +84,7 @@ import debug # pyflakes:ignore
8484
# pass
8585
# connection.queries = DontSaveQueries()
8686

87-
from ietf.name.models import DocTypeName
87+
# from ietf.name.models import DocTypeName
8888
from ietf.utils.html import unescape
8989
from ietf.utils.test_utils import unicontent
9090
from ietf.utils.test_runner import start_vnu_server, vnu_validate, vnu_fmt_message, vnu_filter_message
@@ -257,7 +257,7 @@ def nowstr():
257257
t = time.time_ns()/(10**9)
258258
if nowtime != t:
259259
nowtime = t
260-
nowstrn = timezone.now().strftime('%H:%M:%S').encode()
260+
nowstrn = datetime.datetime.now(tz=datetime.timezone.utc).strftime('%H:%M:%S').encode()
261261
return nowstrn
262262

263263
b_exthost = re.sub(b'https?', b'', args.exthost.encode()) if args.exthost else None
@@ -408,15 +408,45 @@ parser = html5lib.HTMLParser(strict=True)
408408
# because they aren't under our control, such as uploaded group agendas.
409409
validated_urls = {'/meeting/nn/agenda/foo/': True, }
410410

411-
doc_types = [ t.slug for t in DocTypeName.objects.all() ]
411+
# doc_types = [ t.slug for t in DocTypeName.objects.all() ]
412+
doc_types = ["agenda", "bcp", "bluesheets", "bofreq", "charter", "draft", "rfc"] # partial list
412413

413414
errors = 0
414415
warnings = 0
415416
count = 0
416417

417418
start_time = datetime.datetime.now()
418419

419-
client = django.test.Client(Accept='text/html,text/plain,application/json')
420+
# client = django.test.Client(Accept='text/html,text/plain,application/json')
421+
class ExtResponse:
422+
charset = "utf8"
423+
def __init__(self, requests_response):
424+
self._requests_response = requests_response
425+
426+
def __getattr__(self, item):
427+
return getattr(self._requests_response, item)
428+
429+
def __getitem__(self, item):
430+
return self._requests_response.headers[item]
431+
432+
433+
class ExtClient:
434+
base_url = "http://localhost"
435+
accept_header = "text/html,text/plain,application/json"
436+
437+
def get(self, url, **kwargs):
438+
kwargs.pop("secure", None)
439+
headers = kwargs.setdefault("headers", {})
440+
headers["accept"] = self.accept_header
441+
return ExtResponse(
442+
requests.get(
443+
urllib.parse.urljoin(self.base_url, url),
444+
**kwargs,
445+
)
446+
)
447+
448+
449+
client = ExtClient()
420450

421451
logfile = None
422452
if args.logfile:
@@ -450,7 +480,8 @@ if __name__ == "__main__":
450480
do_exit(1)
451481

452482
# Run django system checks and checks from ietf.checks:
453-
error_list = django.core.checks.run_checks()
483+
# error_list = django.core.checks.run_checks()
484+
error_list = []
454485
silenced = []
455486
for i in range(len(error_list)):
456487
if error_list[i].id in settings.SILENCED_SYSTEM_CHECKS:

dev/build/datatracker-start.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ echo "Running Datatracker migrations..."
99
echo "Starting Datatracker..."
1010

1111
gunicorn \
12-
--workers ${DATATRACKER_GUNICORN_WORKERS:-9} \
13-
--max-requests ${DATATRACKER_GUNICORN_MAX_REQUESTS:-32768} \
14-
--timeout ${DATATRACKER_GUNICORN_TIMEOUT:-180} \
12+
--workers "${DATATRACKER_GUNICORN_WORKERS:-9}" \
13+
--max-requests "${DATATRACKER_GUNICORN_MAX_REQUESTS:-32768}" \
14+
--timeout "${DATATRACKER_GUNICORN_TIMEOUT:-180}" \
1515
--bind :8000 \
16-
--log-level ${DATATRACKER_GUNICORN_LOG_LEVEL:-info} \
16+
--log-level "${DATATRACKER_GUNICORN_LOG_LEVEL:-info}" \
1717
ietf.wsgi:application
1818

1919
# Leaving this here as a reminder to set up the env in the chart

0 commit comments

Comments
 (0)