diff --git a/config/config.go b/config/config.go index 65c14d78c..20a43dbc9 100644 --- a/config/config.go +++ b/config/config.go @@ -179,11 +179,11 @@ func LoadReader(fd io.Reader) (config Project, err error) { if err != nil { return config, err } - err = yaml.Unmarshal(data, &config) + if err := yaml.Unmarshal(data, &config); err != nil { + return config, err + } log.WithField("config", config).Debug("loaded config file") - - err = checkOverflows(config) - return + return config, checkOverflows(config) } func checkOverflows(config Project) error { diff --git a/pipeline/snapcraft/snapcraft_test.go b/pipeline/snapcraft/snapcraft_test.go index b434b1769..b2dba9638 100644 --- a/pipeline/snapcraft/snapcraft_test.go +++ b/pipeline/snapcraft/snapcraft_test.go @@ -15,28 +15,25 @@ func TestDescription(t *testing.T) { assert.NotEmpty(t, Pipe{}.Description()) } -func TestRunPipeNoSummary(t *testing.T) { - var assert = assert.New(t) - var ctx = &context.Context{ - Config: config.Project{ - Snapcraft: config.Snapcraft{ - Description: "dummy", - }, +func TestRunPipeMissingInfo(t *testing.T) { + for name, snap := range map[string]config.Snapcraft{ + "missing summary": config.Snapcraft{ + Description: "dummy desc", }, - } - assert.NoError(Pipe{}.Run(ctx)) -} - -func TestRunPipeNoDescription(t *testing.T) { - var assert = assert.New(t) - var ctx = &context.Context{ - Config: config.Project{ - Snapcraft: config.Snapcraft{ - Summary: "dummy", - }, + "missing description": config.Snapcraft{ + Summary: "dummy summary", }, + } { + t.Run(name, func(t *testing.T) { + var assert = assert.New(t) + var ctx = &context.Context{ + Config: config.Project{ + Snapcraft: snap, + }, + } + assert.NoError(Pipe{}.Run(ctx)) + }) } - assert.NoError(Pipe{}.Run(ctx)) } func TestRunPipe(t *testing.T) {