Skip to content

Commit

Permalink
Add test for application descriptions
Browse files Browse the repository at this point in the history
Check that the application documentation page titles match our
standard format and start with a capital letter. This should be
handled automatically by the phalanx application create command
going forward.
  • Loading branch information
rra committed Sep 27, 2023
1 parent ef5052f commit 931ea71
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/applications/kubernetes-replicator/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. px-app:: kubernetes-replicator

#################################################
kubernetes-replicator - Cross-namespace resources
kubernetes-replicator Cross-namespace resources
#################################################

kubernetes-replicator is a Kubernetes operator that replicates resources across namespaces.
Expand Down
6 changes: 3 additions & 3 deletions docs/applications/linters/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. px-app:: linters

######################################
linters - automated chechking of DNS
######################################
####################################
linters — Automated chechking of DNS
####################################

Linters provides a way to automatically and repeatedly check things in ops, such as if DNS entries
are pointing to IP addresses that we are using, or are they dangling. We use the route53 API
Expand Down
5 changes: 2 additions & 3 deletions docs/applications/obsloctap/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
.. px-app:: obsloctap

####################################
obsloctap — serve observing schedule
obsloctap — Serve observing schedule
####################################

Lookup and reformat ``lsst.sal.Scheduler.logevent_predictedSchedule``.
Return a json file of the future observations.
Return a JSON file of the future observations.
Todo: Also track which observations were made implement ObsLocTAP_ IVOA standard.

.. _ObsLocTAP: https://www.ivoa.net/documents/ObsLocTAP/


.. jinja:: obsloctap
:file: applications/_summary.rst.jinja

Expand Down
2 changes: 1 addition & 1 deletion docs/applications/onepassword-connect-dev/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. px-app:: onepassword-connect-dev

####################################################
onepassword-connect-dev - 1Password API server (dev)
onepassword-connect-dev 1Password API server (dev)
####################################################

1Password Connect provides API access to a 1Password vault.
Expand Down
25 changes: 25 additions & 0 deletions tests/docs/applications_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Tests for the application documentation pages."""

from __future__ import annotations

import re
from pathlib import Path


def test_descriptions() -> None:
"""Ensure all application pages have proper short descriptions."""
doc_root = Path(__file__).parent.parent.parent / "docs" / "applications"
for application in doc_root.iterdir():
if not application.is_dir():
continue
index_path = application / "index.rst"
index_rst = index_path.read_text()
m = re.search(r"\n(#+)\n([^\n]+)\n\1\n", index_rst)
assert m, f"No title found in {index_path}"
title = m.group(2)
assert len(title) <= 80, f"Title too long in {index_path}"
m = re.match(r"\S+ — (\S.*$)", title)
assert m, f"Invalid title format in {index_path}"
description = m.group(1)
m = re.match("[A-Z0-9]", description)
assert m, f"Description must start with capital letter in {index_path}"

0 comments on commit 931ea71

Please sign in to comment.