Merge pull request #8316 from alrs/prune-packer-dead-code

packer: Prune Dead Code, Pick Up Dropped Err
This commit is contained in:
Megan Marsh 2019-11-04 13:32:35 -08:00 committed by GitHub
commit ac1e628f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 14 deletions

View File

@ -42,7 +42,7 @@ func TestExpandUser_Empty(t *testing.T) {
var path, expected string
// Try an invalid user
path, err := ExpandUser("~invalid-user-that-should-not-exist")
_, err := ExpandUser("~invalid-user-that-should-not-exist")
if err == nil {
t.Fatalf("expected failure")
}

View File

@ -407,7 +407,7 @@ func (c *Core) init() error {
}
}
if (changed == false) && (shouldRetry == true) {
if !changed && shouldRetry {
return fmt.Errorf("Failed to interpolate %s: Please make sure that "+
"the variable you're referencing has been defined; Packer treats "+
"all variables used to interpolate other user varaibles as "+

View File

@ -670,17 +670,6 @@ func TestSensitiveVars(t *testing.T) {
}
}
func testComponentFinder() *ComponentFinder {
builderFactory := func(n string) (Builder, error) { return new(MockBuilder), nil }
ppFactory := func(n string) (PostProcessor, error) { return new(MockPostProcessor), nil }
provFactory := func(n string) (Provisioner, error) { return new(MockProvisioner), nil }
return &ComponentFinder{
Builder: builderFactory,
PostProcessor: ppFactory,
Provisioner: provFactory,
}
}
func testCoreTemplate(t *testing.T, c *CoreConfig, p string) {
tpl, err := template.ParseFile(p)
if err != nil {

View File

@ -21,7 +21,6 @@ type testBuild struct {
setDebugCalled bool
setForceCalled bool
setOnErrorCalled bool
cancelCalled bool
errRunResult bool
}

View File

@ -112,6 +112,9 @@ func TestPostProcessorRPC_cancel(t *testing.T) {
// Test Configure
config := 42
err := ppClient.Configure(config)
if err != nil {
t.Fatalf("error configuring post-processor client: %s", err)
}
// Test PostProcess
a := &packer.MockArtifact{