Skip to content

Runtime Provider Test Notes

Some Netherframe integration tests depend on a custom Go Terraform provider from the separate terraform-provider-runtime repo.

The main consumer is libs/netherframe.core/tests/test_runtime_terraform_integration.py, which exercises runtime_function and runtime_command through real Terraform CLI workflows.

What The Tests Expect

The test builds the provider from source at runtime. It expects:

  • the provider repo to exist locally
  • a working Go toolchain
  • Linux on amd64 or arm64

Point the test at your checkout of the provider repo with a pytest option:

uv run pytest libs/netherframe.core/tests/test_runtime_terraform_integration.py \
  --nf-runtime-provider-repo /path/to/terraform-provider-runtime

The test uses the go on your PATH; to use another, add --nf-go-bin /path/to/go.

Without the repo, Go or Linux, the tests skip and say which is missing.

What The Test Does

When test_runtime_terraform_integration.py runs, it:

  1. Builds the provider with go build -o <temp binary path> from the provider repo.
  2. Creates a temporary Terraform filesystem mirror under the pytest temp directory.
  3. Writes a temporary .terraformrc pointing Terraform at that local mirror.
  4. Runs terraform init and terraform plan against the synthesized stack.

You do not need to install the provider globally for this test path.

Manual Sanity Check

If the pytest path is failing, first verify that the provider repo builds cleanly on its own:

cd /path/to/terraform-provider-runtime
go build ./...
go test ./...

The repo also has a GNUmakefile, so these are equivalent:

make build
make test

Typical Failure Modes

Provider Repo Not Found

The tests skip, asking for a terraform-provider-runtime checkout.

Fix:

  • clone or sync terraform-provider-runtime
  • give its path with --nf-runtime-provider-repo

Go Toolchain Not Found

The tests skip, saying they need Go to build the runtime provider.

Fix:

  • install Go, or
  • point --nf-go-bin at the actual go binary

Unsupported Platform

The test currently only supports:

  • Linux
  • amd64
  • arm64

That restriction comes from the local provider mirror setup in the test helper; elsewhere the tests skip.

Provider Build Fails

If go build fails inside pytest, rerun it directly in the provider repo first:

cd /path/to/terraform-provider-runtime
go build -v ./...

If that fails, fix the provider repo before debugging Netherframe.

Running The Runtime Terraform Integration Test

Target just this file when debugging:

uv run pytest libs/netherframe.core/tests/test_runtime_terraform_integration.py -v \
  --nf-runtime-provider-repo /path/to/terraform-provider-runtime

If you need one test only:

uv run pytest libs/netherframe.core/tests/test_runtime_terraform_integration.py -k runtime_function -v \
  --nf-runtime-provider-repo /path/to/terraform-provider-runtime