Commit Graph
7 Commits
Author SHA1 Message Date
Wez Furlong be5d5a8c23 run-lua-test: prefer local builds over installed build 2024-07-10 07:59:32 -07:00
Wez Furlong 97286058a1 run-lua-test: prefer debug kumod over release kumod
When we're running tests, we're generally running the debug build, so it
doesn't make sense to run the (potentially cached and not yet up to
date) release build.
2024-07-10 07:56:18 -07:00
Wez Furlong 8c06f7d462 kumod: add --script and --script-args parameters
These are primarily for my benefit; they make it a bit easier
to run kumod for one-off scripts without running the full service,
with less "noise" than you'd get for hacking around it as I was
doing previously in the resolve-site-name script and in the lua
test runner.

The idea is that you can now define a script like:

```lua
local kumo = require 'kumo'

kumo.on('main', function(domain)
  local mx = kumo.dns.lookup_mx(domain)
  print(mx.site_name)
end)
```

And (more) conveniently run it like this:

```
$ kumod --policy /path/to/script --script --script-args outlook.com
outlook-com.olc.protection.outlook.com
```
2024-07-10 07:39:35 -07:00
Wez Furlong 91ce59628d ci: fixup run-lua-test for running in ci 2024-06-28 13:33:47 -07:00
Wez Furlong 9ddc15c7a1 sources.lua: Add typing and test
refs: #211
2024-06-28 13:06:51 -07:00
Wez Furlong f0b91dd652 queue.lua: add typing
I regret optimizing the structure for toml when this module was
created, as it makes it difficult to define a regular schema.

This commit introduces typed records for the queue helper
data structure, and, unfortunately, a parsing layer to adapt
between the toml data and the well-defined types.

It also adjusts how lua tests are run; previously we'd co-opt the main
flow of parsing by looking at an env var, but since the modules can now
potentially require each other (especially the typing module) we need to
de-couple from that, otherwise what happens is that we'd only ever run
the typing module tests and exit. So we now have a script that imports
all the modules and runs their respective `:test()` methods.

refs: #211
2024-06-28 08:54:46 -07:00
Wez Furlong af99c0bb75 run-lua-test: factor out of Makefile
This makes the Makefile less verbose/boilerplate-y
2024-06-27 05:51:11 -07:00