Skip to content

CI: run the tests and a smoke test on every PR - #239

Open
joelhaasnoot wants to merge 2 commits into
masterfrom
ci/github-actions
Open

CI: run the tests and a smoke test on every PR#239
joelhaasnoot wants to merge 2 commits into
masterfrom
ci/github-actions

Conversation

@joelhaasnoot

Copy link
Copy Markdown
Contributor

Adds .github/workflows/ci.yml, running on every pull request and on pushes to master. Both jobs run against a postgis/postgis:17-3.5 service container.

Tests — installs the GeoDjango system libraries, writes a local_settings.py pointing at the service container, runs manage.py test.

Smoke test — migrates, imports a two-line/two-stop RID fixture, boots the server, then logs in and checks the pages actually come back: /bericht, /bericht/nieuw, /kaart, /haltes.geojson, /stop/search.json, /scenario, /ritaanpassing, /admin/. Content assertions where they are cheap — the map page must still contain autocomplete_holder (the search box from #234), the geojson must be a FeatureCollection, and the stop search must return the imported stop.

Verified by running .github/scripts/smoke.py against a real local server: all ten checks pass.

Test discovery was broken

openebs/tests/__init__.py and kv1/tests/__init__.py imported their test modules by hand via loader.find_module(...).load_module(...). Python 3.12 removed find_module, so the whole suite died at import with AttributeError: 'FileFinder' object has no attribute 'find_module' — zero tests ran. Django has discovered test*.py on its own since 1.6, so emptying the initialisers is enough.

The suite is currently red

With discovery fixed, 36 tests run and 24 fail. All of it predates this PR and none of it is touched here:

  • 11 errors in test_command_verifyKeyError: 'QuayCode' / 'OriginalMessageCodeDate'. The rows the tests hand to process_message lack fields verify_messages.py now reads (lines 75, 139, 142).
  • 6 failures in the KV17 XML tests — expected output predates showcancelledtrip / autorecover (Features showcancelled & autorecover #214).
  • 1 error in ferry.tests.test_kv6_autoImproperlyConfigured: Endpoint type isn't registered, raised at import from utils/views.py:89.
  • remaining errors are collateral from the same modules.

So the Tests job will be red until those are dealt with. I left it blocking rather than papering over it — happy to file an issue, or fix them in a follow-up PR if you want to say what the expected behaviour should be.

Stacking

Based on fix/social-login-flag (#238) and contains #237, both of which it needs: without #237 pip install -r requirements.txt fails, and without #238 /inloggen/ 500s in CI with no SocialApp row. Once those merge this collapses to just the CI files. Merge #237 and #238 first.

🤖 Generated with Claude Code

Base automatically changed from fix/social-login-flag to master August 5, 2026 11:48
Joel Haasnoot and others added 2 commits August 5, 2026 15:07
The suite has not run in a while. Test discovery itself was broken:
openebs/tests and kv1/tests imported their modules by hand through
loader.find_module(), which Python 3.12 removed, so nothing ran at all.
Django discovers test*.py by itself, so the initialisers can be empty.

With discovery working, 24 of 36 tests failed. Most were stale fixtures,
but five were real bugs the tests had been unable to report:

- Kv15Scenario.delete_all() filtered on messageendtime__gt=now, passing
  the function instead of calling it, so deleting a planned scenario
  raised TypeError
- sendkv6 compared msg.delay > 0 on a nullable field in two of the three
  places it checks it, so a ferry message without a delay crashed the
  command. The init branch already guarded for None
- get_pushers() raised ImproperlyConfigured when any subscriber lacked
  the message type, and ndovloket_rig has no KV6 endpoint - so KV6 could
  not even be imported. Skip subscribers that do not take the type
- the KV17 journey template read
  "mutation > 0 or shorten > 0 and not is_recovered", and "and" binds
  tighter than "or", so a recover still emitted a mutation message block
- verify_messages matched KV8 deletes with get_or_create() on the KV8
  identity, but an updated message leaves the superseded version behind
  carrying that same identity, so the lookup raised
  MultipleObjectsReturned. Match the most recent one

The rest is fixture rot: stops are matched by QuayCode rather than
timingpointcode, message identity moved to OriginalMessageCode*, mutation
messages moved to their own model, KV17 cancels gained showcancelledtrip
and autorecover, import_rid reads bison_id, and assertEquals is gone in
Python 3.12.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Runs against a postgis service container: one job for the test suite,
one that migrates, imports a small RID fixture, boots the server and
checks the main pages load for a logged-in user - including that the map
still carries its search box.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant