test

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWS

func AWS(schemaDirectoryPath string) (plugin.Provider, error)

func Azure

func Azure(schemaDirectoryPath string) (plugin.Provider, error)

func AzureNative added in v3.2.0

func AzureNative(schemaDirectoryPath string) (plugin.Provider, error)

func CheckAllFilesGenerated

func CheckAllFilesGenerated(t *testing.T, actual, expected map[string][]byte)

CheckAllFilesGenerated ensures that the set of expected and actual files generated are exactly equivalent.

func GeneratePackageFilesFromSchema

func GeneratePackageFilesFromSchema(schemaPath string, genPackageFunc GenPkgSignature) (map[string][]byte, error)

GeneratePackageFilesFromSchema loads a schema and generates files using the provided GeneratePackage function.

func GetSchema

func GetSchema(schemaDirectoryPath, providerName string) ([]byte, error)

func Kubernetes

func Kubernetes(schemaDirectoryPath string) (plugin.Provider, error)

func LoadBaseline added in v3.6.1

func LoadBaseline(dir, lang string) (map[string][]byte, error)

LoadBaseline loads the contents of the given baseline directory.

func LoadFiles

func LoadFiles(dir, lang string, files []string) (map[string][]byte, error)

LoadFiles loads the provided list of files from a directory.

func NewHost

func NewHost(schemaDirectoryPath string) plugin.Host

func Random

func Random(schemaDirectoryPath string) (plugin.Provider, error)

func RewriteFilesWhenPulumiAccept added in v3.2.0

func RewriteFilesWhenPulumiAccept(t *testing.T, dir, lang string, actual map[string][]byte) bool

If PULUMI_ACCEPT is set, writes out actual output to the expected file set, so we can continue enjoying golden tests without manually modifying the expected output.

func TestSDKCodegen added in v3.6.1

func TestSDKCodegen(t *testing.T, language string, genPackage GenPkgSignature)

TestSDKCodegen runs the complete set of SDK code generation tests against a particular language's code generator.

An SDK code generation test consists of a schema and a set of expected outputs for each language. Each test is structured as a directory that contains that information:

test-directory/
    schema.(json|yaml)
    language-0
    ...
    language-n

The schema is the only piece that must be manually authored. Once the schema has been written, the expected outputs can be generated by running `PULUMI_ACCEPT=true go test ./..." from the `pkg/codegen` directory.

func TestTypeNameCodegen added in v3.7.0

func TestTypeNameCodegen(t *testing.T, language string, newTypeNameGenerator NewTypeNameGeneratorFunc)

func ValidateFileEquality

func ValidateFileEquality(t *testing.T, actual, expected map[string][]byte)

ValidateFileEquality compares maps of files for equality.

Types

type GenPkgSignature

type GenPkgSignature func(string, *schema.Package, map[string][]byte) (map[string][]byte, error)

GenPkgSignature corresponds to the shape of the codegen GeneratePackage functions.

type NewTypeNameGeneratorFunc added in v3.7.0

type NewTypeNameGeneratorFunc func(pkg *schema.Package) TypeNameGeneratorFunc

type TypeNameGeneratorFunc added in v3.7.0

type TypeNameGeneratorFunc func(t schema.Type) string

Jump to

Keyboard shortcuts

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