]> git.ipfire.org Git - thirdparty/bind9.git/commit
Support jinja2 templates in pytest runner
authorNicki Křížek <nicki@isc.org>
Tue, 1 Oct 2024 12:45:36 +0000 (14:45 +0200)
committerNicki Křížek <nicki@isc.org>
Wed, 30 Oct 2024 17:00:20 +0000 (18:00 +0100)
commit60e118c4fb7085030f47ef69e136fc6ca710b009
tree31c91d6713bb5401b974979d505f7f741ce3181c
parent887b04571b5ea02abd17579eac70b3c8a8ec5f0e
Support jinja2 templates in pytest runner

Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.
bin/tests/system/README.md
bin/tests/system/conftest.py
bin/tests/system/isctest/__init__.py
bin/tests/system/isctest/template.py [new file with mode: 0644]