Skip to content

test: template rendering test suite for all recipes#68

Draft
troglodyne-bot wants to merge 1 commit into
Troglodyne-Internet-Widgets:masterfrom
troglodyne-bot:koan/recipe-test-suite
Draft

test: template rendering test suite for all recipes#68
troglodyne-bot wants to merge 1 commit into
Troglodyne-Internet-Widgets:masterfrom
troglodyne-bot:koan/recipe-test-suite

Conversation

@troglodyne-bot

Copy link
Copy Markdown
Contributor

What

First test suite for this repo — t/templates.t with 42 tests covering every recipe module.

Why

Zero test coverage meant template bugs only surfaced in production. Template::Toolkit rendering is pure Perl so these run in CI with no provisioning infrastructure.

How

  • renders_ok() helper: instantiates each recipe, calls render() with minimal valid config, asserts no exception and non-empty output
  • rejects_missing() helper: verifies validate() dies when a required field is absent
  • Recipes needing filesystem fixtures (backup, backupdestination) create a temp RSA keypair via ssh-keygen
  • Module-dependent recipes (matrix, roundcube) receive modules => ['nginxproxy'] in test config
  • Global vars from bin/new_config (domain, install_dir, script_dir, packager_invocation, etc.) are provided as a shared %G hash

Also adds TEST_REQUIRES to Makefile.PL.

Testing

PERL5LIB=/tmp/cpanlib/lib/perl5 make test — 42/42 pass.

Deps not in default Ubuntu install: cpanm Text::Xslate Text::Xslate::Bridge::TT2 Hash::Merge YAML File::Slurper Clone Net::IP UUID CryptX

42 tests across every recipe module in the repo: verifies that
render() completes without error given valid minimal config, and that
validate() dies on missing required fields.  Recipes requiring
filesystem fixtures (backup, backupdestination) spin up a temp SSH
keypair via ssh-keygen.  Module dependencies (matrix, roundcube) are
satisfied by passing modules => ['nginxproxy'] in the test config.

Also adds TEST_REQUIRES to Makefile.PL.

Co-Authored-By: Claude Sonnet 4.6 <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