Skip to content

Commit

Permalink
ci: merge main to relase (#8332)
Browse files Browse the repository at this point in the history
ci: merge main to release
  • Loading branch information
rjsparks authored Dec 12, 2024
2 parents 90d4a17 + ec67f34 commit def346e
Show file tree
Hide file tree
Showing 32 changed files with 34 additions and 2,397 deletions.
2 changes: 1 addition & 1 deletion dev/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ietf-tools/datatracker-app-base:20241127T2054
FROM ghcr.io/ietf-tools/datatracker-app-base:20241212T1741
LABEL maintainer="IETF Tools Team <[email protected]>"

ENV DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion dev/build/TARGET_BASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20241127T2054
20241212T1741
5 changes: 4 additions & 1 deletion dev/build/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,21 @@ def _describe_request(req):
start and end of handling a request. E.g., do not include a timestamp.
"""
client_ip = "-"
asn = "-"
cf_ray = "-"
for header, value in req.headers:
header = header.lower()
if header == "cf-connecting-ip":
client_ip = value
elif header == "x-ip-src-asnum":
asn = value
elif header == "cf-ray":
cf_ray = value
if req.query:
path = f"{req.path}?{req.query}"
else:
path = req.path
return f"{req.method} {path} (client_ip={client_ip}, cf_ray={cf_ray})"
return f"{req.method} {path} (client_ip={client_ip}, asn={asn}, cf_ray={cf_ray})"


def pre_request(worker, req):
Expand Down
1 change: 0 additions & 1 deletion dev/deploy-to-container/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

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/'

Expand Down
1 change: 0 additions & 1 deletion dev/diff/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

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/'

Expand Down
1 change: 0 additions & 1 deletion dev/tests/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

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/'

Expand Down
1 change: 0 additions & 1 deletion docker/configs/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

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/'

Expand Down
4 changes: 2 additions & 2 deletions ietf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ def skip_unreadable_post(record):
SESSION_REQUEST_FROM_EMAIL = 'IETF Meeting Session Request Tool <[email protected]>'

SECRETARIAT_SUPPORT_EMAIL = "[email protected]"
SECRETARIAT_ACTION_EMAIL = "[email protected]"
SECRETARIAT_INFO_EMAIL = "[email protected]"
SECRETARIAT_ACTION_EMAIL = SECRETARIAT_SUPPORT_EMAIL
SECRETARIAT_INFO_EMAIL = SECRETARIAT_SUPPORT_EMAIL

# Put real password in settings_local.py
IANA_SYNC_PASSWORD = "secret"
Expand Down
127 changes: 7 additions & 120 deletions ietf/stats/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@
import debug # pyflakes:ignore

from django.urls import reverse as urlreverse
from django.utils import timezone

from ietf.utils.test_utils import login_testing_unauthorized, TestCase
import ietf.stats.views

from ietf.submit.models import Submission
from ietf.doc.factories import WgDraftFactory, WgRfcFactory
from ietf.doc.models import Document, State, RelatedDocument, NewRevisionDocEvent, DocumentAuthor

from ietf.group.factories import RoleFactory
from ietf.meeting.factories import MeetingFactory, AttendedFactory
from ietf.meeting.factories import MeetingFactory
from ietf.person.factories import PersonFactory
from ietf.person.models import Person, Email
from ietf.name.models import FormalLanguageName, DocRelationshipName, CountryName
from ietf.review.factories import ReviewRequestFactory, ReviewerSettingsFactory, ReviewAssignmentFactory
from ietf.stats.models import MeetingRegistration, CountryAlias
from ietf.stats.factories import MeetingRegistrationFactory
from ietf.stats.models import MeetingRegistration
from ietf.stats.tasks import fetch_meeting_attendance_task
from ietf.stats.utils import get_meeting_registration_data, FetchStats, fetch_attendance_from_meetings
from ietf.utils.timezone import date_today
Expand All @@ -41,121 +35,14 @@ def test_stats_index(self):
self.assertEqual(r.status_code, 200)

def test_document_stats(self):
WgRfcFactory()
draft = WgDraftFactory()
DocumentAuthor.objects.create(
document=draft,
person=Person.objects.get(email__address="[email protected]"),
email=Email.objects.get(address="[email protected]"),
country="Germany",
affiliation="IETF",
order=1
)

# create some data for the statistics
Submission.objects.create(
authors=[ { "name": "Some Body", "email": "[email protected]", "affiliation": "Some Inc.", "country": "US" }],
pages=30,
rev=draft.rev,
words=4000,
draft=draft,
file_types=".txt",
state_id="posted",
)

draft.formal_languages.add(FormalLanguageName.objects.get(slug="xml"))
Document.objects.filter(pk=draft.pk).update(words=4000)
# move it back so it shows up in the yearly summaries
NewRevisionDocEvent.objects.filter(doc=draft, rev=draft.rev).update(
time=timezone.now() - datetime.timedelta(days=500))

referencing_draft = Document.objects.create(
name="draft-ietf-mars-referencing",
type_id="draft",
title="Referencing",
stream_id="ietf",
abstract="Test",
rev="00",
pages=2,
words=100
)
referencing_draft.set_state(State.objects.get(used=True, type="draft", slug="active"))
RelatedDocument.objects.create(
source=referencing_draft,
target=draft,
relationship=DocRelationshipName.objects.get(slug="refinfo")
)
NewRevisionDocEvent.objects.create(
type="new_revision",
by=Person.objects.get(name="(System)"),
doc=referencing_draft,
desc="New revision available",
rev=referencing_draft.rev,
time=timezone.now() - datetime.timedelta(days=1000)
)
r = self.client.get(urlreverse("ietf.stats.views.document_stats"))
self.assertRedirects(r, urlreverse("ietf.stats.views.stats_index"))


# check redirect
url = urlreverse(ietf.stats.views.document_stats)

authors_url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": "authors" })

r = self.client.get(url)
self.assertEqual(r.status_code, 302)
self.assertTrue(authors_url in r["Location"])

# check various stats types
for stats_type in ["authors", "pages", "words", "format", "formlang",
"author/documents", "author/affiliation", "author/country",
"author/continent", "author/citations", "author/hindex",
"yearly/affiliation", "yearly/country", "yearly/continent"]:
for document_type in ["", "rfc", "draft"]:
for time_choice in ["", "5y"]:
url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": stats_type })
r = self.client.get(url, {
"type": document_type,
"time": time_choice,
})
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('#chart'))
if not stats_type.startswith("yearly"):
self.assertTrue(q('table.stats-data'))

def test_meeting_stats(self):
# create some data for the statistics
meeting = MeetingFactory(type_id='ietf', date=date_today(), number="96")
MeetingRegistrationFactory(first_name='John', last_name='Smith', country_code='US', email="[email protected]", meeting=meeting, attended=True)
CountryAlias.objects.get_or_create(alias="US", country=CountryName.objects.get(slug="US"))
p = MeetingRegistrationFactory(first_name='Jaume', last_name='Guillaume', country_code='FR', email="[email protected]", meeting=meeting, attended=False).person
CountryAlias.objects.get_or_create(alias="FR", country=CountryName.objects.get(slug="FR"))
AttendedFactory(session__meeting=meeting,person=p)
# check redirect
url = urlreverse(ietf.stats.views.meeting_stats)

authors_url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": "overview" })

r = self.client.get(url)
self.assertEqual(r.status_code, 302)
self.assertTrue(authors_url in r["Location"])

# check various stats types
for stats_type in ["overview", "country", "continent"]:
url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": stats_type })
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('#chart'))
if stats_type == "overview":
self.assertTrue(q('table.stats-data'))
r = self.client.get(urlreverse("ietf.stats.views.meeting_stats"))
self.assertRedirects(r, urlreverse("ietf.stats.views.stats_index"))

for stats_type in ["country", "continent"]:
url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": stats_type, "num": meeting.number })
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('#chart'))
self.assertTrue(q('table.stats-data'))

def test_known_country_list(self):
# check redirect
Expand Down
Loading

0 comments on commit def346e

Please sign in to comment.