Skip to content

Pass the payload, pass envvars with value, add test

First commit is from !15 (merged), the others are mostly prep work for tests. New features here that I'm too tired to spin out into multiple MRs:

  • support for env: [ "FOO=BAR", "GITLAB_TOKEN"], i.e. env vars with values. This is needed for the integration tests (last commit)
  • the payload we got called with is passed to the forked process via the HOOKIE_PAYLOAD env var. Unfortunately that's the only way I can think of on how to do this, --pipe in systemd-run doesn't work well here
  • a set of tests to check our URL parsing and status codes are correct
  • a set of tests using a helper script that checks whether our payload is passed down to correctly, see below

For the integration tests, each tests:

  • composes a settings.yaml file with some rules
  • starts hookie with that file and fixed hardcoded payload
  • creates a /tmp/hookie-socket-1234 socket and reads data from that

The process invoked via systemd-run is a helper script that:

  • reads HOOKIE_PAYLOAD
  • writes it into the socket (passed via env var)

The test can then compare the data read via the socket with the payload we sent to hookiedookie, and voila, we have an integration test. This still uses the actix test framework (not a full httpserver) but if that doesn't work it's someone else's job to fix.

Merge request reports

Loading