Documentation ¶
Index ¶
- func ExampleSecretFromComposition(v schema.ValueComposition) string
- func LoadFixture(t *testing.T, filename string) string
- func PrintReportIfErrors(plugin schema.Plugin) (hasErrors bool)
- func PrintValidationReport(plugin schema.Plugin)
- func TestImporter(t *testing.T, importer sdk.Importer, cases map[string]ImportCase)
- func TestNeedsAuth(t *testing.T, rule sdk.NeedsAuthentication, cases map[string]NeedsAuthCase)
- func TestProvisioner(t *testing.T, provisioner sdk.Provisioner, cases map[string]ProvisionCase)
- type ImportCase
- type NeedsAuthCase
- type PrintFormat
- type ProvisionCase
- type ValidationReportPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleSecretFromComposition ¶
func ExampleSecretFromComposition(v schema.ValueComposition) string
func LoadFixture ¶
LoadFixture loads the test fixture file from the "test-fixtures" dir in the plugin directory. It fails the test if the file can't be loaded.
func PrintReportIfErrors ¶
func PrintValidationReport ¶
func TestImporter ¶
TestImporter will run the importer for each specified case, mounting the specified files in a temp dir, setting the environment variables, and configuring the home path using the temp dir.
func TestNeedsAuth ¶
func TestNeedsAuth(t *testing.T, rule sdk.NeedsAuthentication, cases map[string]NeedsAuthCase)
func TestProvisioner ¶
func TestProvisioner(t *testing.T, provisioner sdk.Provisioner, cases map[string]ProvisionCase)
TestProvisioner will invoke the specified provisioner with the item fields specified in each test case, comparing the provisioner output with the specified expected output.
Types ¶
type ImportCase ¶
type ImportCase struct { // Environment can be used to set environment variables for the importer test. Environment map[string]string // Files can be used to set files for the importer test, using the format: path -> contents. // For example: ~/.config/my-pugin/config -> '{"foo":"bar"}'. This is useful in conjunction with the // LoadFixture helper. Files map[string]string // OS can be used to test OS-specific importers. Supported values: "darwin", "linux" OS string // ExpectedCandidates is a shorthand to set the expected import candidates. Mutually exclusive with ExpectedOutput. ExpectedCandidates []sdk.ImportCandidate // ExpectedOutput can be used to set the exact expected import output. Mutually exclusive with ExpectedCandidates. ExpectedOutput *sdk.ImportOutput }
type NeedsAuthCase ¶
type PrintFormat ¶
type PrintFormat struct { Heading *color.Color Warning *color.Color Error *color.Color Success *color.Color }
func (PrintFormat) ValidationReportFormat ¶
func (pf PrintFormat) ValidationReportFormat() PrintFormat
type ProvisionCase ¶
type ProvisionCase struct { // ItemFields can be used to populate the item fields to pass to the provisioner. ItemFields map[sdk.FieldName]string // CommandLine can be used to populate the command line to pass to the provisioner. CommandLine []string // ExpectedOutput can be used to set the exact expected provision output, which contains the // environment, files, and command line. ExpectedOutput sdk.ProvisionOutput }
type ValidationReportPrinter ¶
type ValidationReportPrinter struct { Reports []schema.ValidationReport Format PrintFormat }
func (*ValidationReportPrinter) Print ¶
func (p *ValidationReportPrinter) Print()
func (*ValidationReportPrinter) PrintReport ¶
func (p *ValidationReportPrinter) PrintReport(report schema.ValidationReport)
Click to show internal directories.
Click to hide internal directories.