Updated test logic and Error->Errof for formatted output.

This commit is contained in:
tcarrio 2018-07-16 01:51:14 -04:00 committed by Tom Carrio
parent 6dc71590eb
commit 3a6ab0fc0e
2 changed files with 2 additions and 2 deletions

View File

@ -133,6 +133,6 @@ func TestImageFilterOptionsDecode(t *testing.T) {
} }
err := mapstructure.Decode(input, &opts) err := mapstructure.Decode(input, &opts)
if err != nil { if err != nil {
t.Error("Did not successfully generate ImageFilterOptions from %v. Contains %v", input, opts) t.Errorf("Did not successfully generate ImageFilterOptions from %v. Contains %v", input, opts)
} }
} }

View File

@ -76,7 +76,7 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
} }
} }
if c.SourceImage == "" && c.SourceImageName == "" && c.SourceImageFilters.Filters != nil { if c.SourceImage == "" && c.SourceImageName == "" && c.SourceImageFilters.Filters == nil {
errs = append(errs, errors.New("Either a source_image, a source_image_name, or must be specified")) errs = append(errs, errors.New("Either a source_image, a source_image_name, or must be specified"))
} else if len(c.SourceImage) > 0 && len(c.SourceImageName) > 0 { } else if len(c.SourceImage) > 0 && len(c.SourceImageName) > 0 {
errs = append(errs, errors.New("Only a source_image or a source_image_name can be specified, not both.")) errs = append(errs, errors.New("Only a source_image or a source_image_name can be specified, not both."))