plugintest

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(t *testing.T, spec dataspec.RootSpec, body string) (v cty.Value, diags diagnostics.Diag)

func DecodeAndAssert

func DecodeAndAssert(t *testing.T, spec dataspec.RootSpec, body string, dataCtx plugin.MapData, asserts diagtest.Asserts) (v cty.Value)

Decodes a string (representing content of a config/data/content block) into cty.Value according to given spec (i.e. respecting default values)

func ReencodeCTY

func ReencodeCTY(t *testing.T, spec dataspec.RootSpec, val cty.Value, asserts [][]diagtest.Assert) cty.Value

We have a massive amount of tests that break as soon as we add schemas with default values. This function is a workaround. It reencodes provided cty.Value to hcl text and then re-parses that text in accordance to spec. Ugly hack, but there's over a 100 tests in need of a rewrite that can't be automated with regex or similar. New tests should use Decode and provide a string of hcl.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL